The Apache configuration file is/usr/local/lib/php. ini. Compile the php. ini file to configure PHP options. Note that after the installation is complete, the register_globals variable is set to Off by default and needs to be changed to On. Otherwise, PHP will not be able to read post data.
1, # cp httpd-2.0.47.tar.gz to/usr/local/
2. # tar zxvf php-4.3.3.tar.gz
3, # cd php-4.3.3
4, #./configure -- with-mysql -- with-apxs2 =/usr/local/apache/bin/apxs
#./Configure-with-apache =/path/to/apache/dir-with-mysql =/usr/local/mysql
5. # make
6. # make install)
7. # cp php. ini-dist/usr/local/lib/php. ini
8. # vi/usr/local/apache2/conf/httpd. conf
9. add the following under AddType application/x-tar.tgz:
AddType application/x-httpd-php. php
LoadModule php4_module/var/www/modules/libphp4.so (if not, add)
10. # vi/usr/local/apache2/htdocs/test. php
Echo phpinfo ();
?>
11. browse http: // ip/test. php. Displays php information. Congratulations! this step is successful.
Basic configuration of PHP and Apache after installation
1. Apache configuration
The Apache configuration file is/usr/local/apache2/conf/httpd. conf. Compile the httpd. conf file and add the following lines at the end of the file:
LoadModule php4_module modules/libphp4.so
AddType application/x-httpd-php. php. php3
At the same time, the DirectoryIndex is changed:
DirectoryIndex index.htm
DirectoryIndex index.html
DirectoryIndex index. php
DirectoryIndex index. php3
DirectoryIndex index. php4
Apache has rich configuration content. for other Apache related configurations, see related Apache documents.
2. PHP configuration
The Apache configuration file is/usr/local/lib/php. ini. Compile the php. ini file to configure PHP options. Note that after the installation is complete, the register_globals variable is set to Off by default and needs to be changed to On. Otherwise, PHP will not be able to read post data.
Zlib. output_compression = On
Register_globals = On
For other PHP options, see related documents.
3. test
You can write a simple php file to test the installation. The file contains the following lines:
Keep it as/usr/local/apache2/htdocs/info. php, start Apache, and then browse in the browser.