一、下载PHPtar.gz 包
wget http://cn2.PHP.net/distributions/PHP-5.4.40.tar.gz@H_404_3@ tar -xvzf PHP-5.4.40.tar.gz @H_404_3@ cd PHP-5.4.40
二 下载相关的组件
wget http://ah1.down.chinaz.com/201303/PHP-v5.4.13.tar.gz@H_404_3@ wget http://soft.7dot.com/soft/libevent-2.0.12-stable.tar.gz@H_404_3@ wget http://soft.7dot.com/soft/libiconv-1.14.tar.gz
wget http://soft.7dot.com/soft/libmcrypt-2.5.8.tar.gz
wget http://soft.7dot.com/soft/mcrypt-2.6.8.tar.gz
wget http://soft.7dot.com/soft/mhash-0.9.9.9.tar.gz
wget http://soft.7dot.com/soft/pcre-8.33.tar.gz@H_404_3@ @H_404_3@ 安装依赖软件【软件目录/usr/lcoal/src】@H_404_3@ yum -y install gcc@H_404_3@ yum install -y gcc gcc-c++
tar zxvf pcre-8.33.tar.gz@H_404_3@ cd pcre-8.33
./configure --prefix=/usr/local@H_404_3@ make && make install
@H_404_3@ tar zxvf libiconv-1.14.tar.gz@H_404_3@ cd libiconv-1.14
./configure --prefix=/usr/local@H_404_3@ make && make install@H_404_3@ @H_404_3@ tar zxvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8/
./configure
make && make install
/sbin/ldconfig
cd libltdl/
./configure --enable-ltdl-install@H_404_3@ make && make install@H_404_3@ @H_404_3@ tar zxvf mhash-0.9.9.9.tar.gz
cd mhash-0.9.9.9/
./configure
make && make install
cd ../
安装PHP
./configure --prefix=/usr/local/PHP --with-config-file-path=/usr/local/PHP/etc --with-MysqL=/usr/local/MysqL/ --with-MysqLi=/usr/local/MysqL/bin/MysqL_config --with-pdo-MysqL=/usr/local/MysqL/ --with-fpm-user=www --with-fpm-group=www --with-pcre-regex --with-zlib --with-bz2 --enable-calendar --with-curl --enable-dba --with-libxml-dir --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir --enable-xml --with-pdo-MysqL --with-openssl --with-xsl --enable-mbstring --with-mcrypt --with-mhash --enable-fpm
其中会报很多错误 。都是因为缺少相关的组件
make && make install
PHP-fpm 安装和启动@H_404_3@ cp /usr/local/PHP-5.4.40/etc/PHP-fpm.conf.default /usr/local/etc/PHP-fpm.conf@H_404_3@ cp /usr/local/etc/PHP-fpm.conf /usr/local/PHP/etc/PHP-fpm.conf@H_404_3@ @H_404_3@ 查看和编辑PHP-fpm.conf 文件
vi /usr/local/PHP/etc/PHP-fpm.conf@H_404_3@ pid = run/PHP-fpm.pid@H_404_3@ user = www@H_404_3@ group = www@H_404_3@ @H_404_3@ 新建www 用户组@H_404_3@ groupadd www@H_404_3@ useradd -g www www@H_404_3@ @H_404_3@ 启动PHP-fpm
/usr/local/PHP/sbin/PHP-fpm@H_404_3@ @H_404_3@ cp /usr/local/src/PHP-v5.4.13/sapi/fpm/init.d.PHP-fpm /etc/init.d/PHP-fpm@H_404_3@ @H_404_3@ 查看PHP-fpm 是否启动
ps -ef|grep PHP-fpm
开机启动PHP cp /usr/local/PHP-5.4.40/sapi/fpm/init.d.PHP-fpm /etc/init.d/PHP-fpm chmod +x /etc/init.d/PHP-fpm chkconfig --add PHP-fpm chkconfig --level 2345 PHP-fpm on