1, to resolve the dependency relationship:
If you want to have the compiled PHP support mcrypt extension, you need to download the following two RPM packages and install them:
libmcrypt-2.5.7-5.el5.i386.rpm
libmcrypt-devel-2.5.7-5.el5.i386.rpm
Note: www.rpmfind.net
2. Compile and install php-5.4.13
First download the source package to the local directory, download location ftp://172.16.0.1/pub/Sources/new_lamp.
# Tar XF php-5.4.13.tar.bz2# cd php-5.4.13#./configure--prefix=/usr/local/php--with-mysql=/usr/local/mysql-- With-openssl--with-mysqli=/usr/local/mysql/bin/mysql_config--enable-mbstring--with-freetype-dir--with-jpeg-dir --with-png-dir--with-zlib--with-libxml-dir=/usr--enable-xml--enable-sockets--with-apxs2=/usr/local/apache/bin/ Apxs--with-mcrypt--with-config-file-path=/etc--with-config-file-scan-dir=/etc/php.d--with-bz2-- enable-maintainer-zts# make# make test# make Intall
Description
(1, here in order to support the Apache worker or event of the two mpm, compile using the--ENABLE-MAINTAINER-ZTS option.
(2, if you use PHP5.3 or above, in order to link the MySQL database, you can specify MYSQLND, so that you do not need to install the MySQL or MySQL development package in this machine first. MYSQLND is available from PHP 5.3 and can be bound to it at compile time (instead of relying on the specific MySQL client library bindings), but it is the default setting starting with PHP 5.4.
#./configure--with-mysql=mysqlnd--with-pdo-mysql=mysqlnd--with-mysqli=mysqlnd
(3 、--with-apxs2=/usr/local/apache/bin/apxs to compile PHP into a httpd module, if you want to combine fcgi mode with HTTP you need to replace this with--ENABLE-FPM
To provide a configuration file for PHP:
# CP Php.ini-production/etc/php.ini
3, edit Apache configuration file httpd.conf, with Apache support PHP
# vim/etc/httpd/httpd.conf
1, add the following two lines
AddType application/x-httpd-php. php
AddType Application/x-httpd-php-source. Phps
2. Locate to DirectoryIndex index.html
Modified to:
DirectoryIndex index.php index.html
Then restart httpd, or let it reload the configuration file to test if PHP is already working.
Compile and install lamp (iii)--compile and install php-5.4.13