tar xvf 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-scan-dir=/etc/php.d --with-bz2 --enable-maintainer-zts
此处安装会报错:
configure: error: mcrypt.h not found.Please reinstall libmcrypt.
我们需要安装加密库需要的软件包:
rpm -ivh mhash-devel-0.9.2-6.el5.i386.rpm mhash-0.9.2-6.el5.i386.rpm libmcrypt-devel-2.5.7-5.el5.i386.rpm libmcrypt-2.5.7-5.el5.i386.rpm
make &&make install
此时,php安装完毕
推荐阅读:
Ubuntu 13.04 安装 LAMP\Vsftpd\Webmin\phpMyAdmin 服务及设置
CentOS 5.9下编译安装LAMP(Apache 2.2.44+MySQL 5.6.10+PHP 5.4.12)
RedHat 5.4下Web服务器架构之源码构建LAMP环境及应用PHPWind
LAMP源码环境搭建WEB服务器Linux+Apache+MySQL+PHP