Home  >  Article  >  Backend Development  >  Analysis of the specific method of installing PHP as Apache DSO_PHP tutorial

Analysis of the specific method of installing PHP as Apache DSO_PHP tutorial

WBOY
WBOYOriginal
2016-07-15 13:29:54856browse

We are using Due to ease of maintenance and upgrade, we need to implement PHP installation as Apache DSO. For example, if the installed PHP only supports databases during the initial installation, and then you want to install modules that support encryption, just run "make clean", add new configuration options, and then run "make" and "make install", one The new PHP module will be installed in the appropriate location in Apache, and Apache will be restarted without recompiling Apache.

The following steps will install a new Apache and install PHP as Apache's DSO:

1. Obtain the latest version of Apache source code from the Apache Software Foundation;

2. Put the obtained source code in the /usr/local/ or /opt/ directory, or any directory you specify;

3. Run Gunzip to decompress the file and get the suffix: .tar file;

4. Run the following command to install the file into the apache_[version] directory:

tar -xvf apache_[version].tar

5. Enter the /usr/local/apache_[version] directory (or the directory where the compressed file was installed in step 4);

6. Type the following command to prepare for compiling Apache, and replace it with your own path The [path], for example, /usr/local/apache[version], has now set the new value of mod_so, which will allow Apache to use the DSO module;

7. After returning to the prompt state, type make, and wait to return to the prompt state again;

8. Execute the "make install" command.

At this point, Apache has been installed and the system will return to the prompt state. Next we start the steps to install PHP as Apache DSO:

1. Find the link to the latest version in the download area of ​​the PHP homepage;

2. Download the file to an appropriate directory in, such as /usr/local/ or /opt/ or any directory you specify;

3. Run Gunzip to decompress the file and obtain a file with the suffix .tar;

4. Execute the following command to install the file in the php-[version] directory:

tar -xvf php-[version]

5. Enter /usr/local/php-[version ] directory or the directory specified in step 4;

At this point, preparations have been made to install PHP as Apache's DSO. The only configuration option that needs to be modified is with-apxs (this is the bin directory of Apache in a file). In order to get higher performance, I did not install the support module for MySQL.

./configure --with-mysql=/[path to mysql] --with-apxs=/[path to apxs]

6. Execute the make command after returning to the prompt state , wait to return to the prompt state;

7. Execute the make install command.

At this point, the system has installed PHP in Apache's module directory in DSO mode, made appropriate modifications to Apache's httpd.conf file, and returned to the prompt state. After returning to the prompt state, you still need to make some modifications to Apache's httpd.conf file.

1. Find the line that contains ServerAdmin and add your email address as follows:

ServerAdmin you@yourdomain.com

2. Find the line that starts with ServerName line, change it to a real value, for example:

ServerName localhost

3. Find the section with the following content:

# And for PHP 4.x , use:

#

#AddType application/x-httpd-php .php

#AddType application/x-httpd-php-source .phps

Modify the content of these lines so that the AddType of PHP 4.0 is no longer a comment, and add the file suffix you want to use in PHP. The above content becomes the following content:

# And for PHP 4.x, use:

#

AddType application/x-httpd-php .php .phtml

AddType application/x-httpd-php-source .phps

Save the file, return to the previous directory, and execute the following command to restart Apache:

./bin/apachectl start

If no error message appears during startup Information, you can test the installed Apache and PHP installed as Apache DSO by creating a file named phpinfo.php with only one line of content as shown below:

Save this file to the document root directory (htdocs) of Apache, then open the browser and type the address http://localhost/phpinfo.php. Many variables and their properties will appear on the screen. value.

If you want to reconfigure PHP, you need to run the make clean command again, then execute the ./configure command with a series of options, and then execute the make and make install commands. A new directory module will appear in Apache module, as long as you restart Apache to load this new module, and PHP is installed as Apache's DSO, everything will be OK.


www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/446335.htmlTechArticleWe are using DSO for easy maintenance and upgrade, so we need to implement PHP installation as Apache DSO. For example, if the installed PHP only supports databases during the initial installation, and then you want to install support...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn