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 (while waiting for the side to bless it)
7. #cp Php.ini-dist/usr/local/lib/php.ini
8. #vi/usr/local/apache2/conf/httpd.conf
9. Under AddType application/x-tar.tgz, add the following:
AddType application/x-httpd-php. php
LoadModule php4_module/var/www/modules/libphp4.so (if not added)
10. #vi/usr/local/apache2/htdocs/test.php
?
Echo Phpinfo ();
?>
11, browse http://ip/test.php. The PHP information appears. Congratulations on the success of this step.
Basic configuration of PHP and Apache after installation
1.Apache of configuration
The Apache configuration file is/usr/local/apache2/conf/httpd.conf, edit the httpd.conf file, and add the following two lines to the end of the file:
LoadModule Php4_module modules/libphp4.so
AddType application/x-httpd-php. php. php3
At the same time modify DirectoryIndex to:
DirectoryIndex index.htm
DirectoryIndex index.html
DirectoryIndex index.php
DirectoryIndex index.php3
DirectoryIndex INDEX.PHP4
Apache configuration is rich in content, other Apache related configuration Please refer to the Apache related documentation.
2.PHP of configuration
The Apache configuration file is/usr/local/lib/php.ini, editing the php.ini file to configure PHP options. It is particularly noted that the Register_globals variable is set to off by default after installation, and needs to be changed to ON. Otherwise, there will be a phenomenon that PHP cannot read the post data.
Zlib.output_compression=on
Register_globals=on
Other PHP options please refer to the relevant documentation.
3. Test
Can write a simple php file to test the installation, the file contains the following line:
Save it as/usr/local/apache2/htdocs/info.php, start Apache, and then browse through the browser.