Before installing php software in rhel5, there are several conditions to be met. As follows:
1, rpm-ivh zlib-devel-1.2.3-3.i386.rpm
2, rpm-ivh libxml2-devel-2.6.26-2.1.2.8.i386.rpm
(The above two packages are under the Server directory of the RHEL5.5 installation CD)
Next, we will install PHP.
Note: my mysql is installed in the RPM package, and the mysql header file is mysql. h, which is located in the/usr/include/mysql/directory. Another point is that three files, server, client, and devel, should be installed during mysql installation. The header file mysql. h can be found only after devel is installed.
#./Configure -- prefix =/usr/local/php -- with-apxs2 =/usr/local/apache2/bin/apxs -- with-mysql =/usr/include/mysql/
# Make
# Make install
# Make test
Configure the php. ini file
For my php-5.3.8.tar.gz version, two files, php. ini-development and php. ini-production, will be decompressed.
Copy the php. ini-development file to/usr/local/php/lib under the php installation directory and change the file name to php. ini.
Configure the httpd. conf file of apache after installation
Add
LoadModule php5_module modules/libphp5.so // This module is automatically written to the httpd. conf file when installing php.
AddType Application/x-httpd-php. php // you need to manually add
DirectoryIndex index.html. var index. php
If you run a php program
Put the php program under htdocs under apache.
Restart apache.