一、下载源码包后,进行解压
[root@www home]# tar zxf php-5.6.8.tar.bz2 gzip: stdin: not in gzip format tar: Child returned status 1 tar: Error is not recoverable: exiting now #妈耶,好尴尬呀,zxf可不能解压*.tar.bz2文件,嘿嘿
[root@www home]# tar xjf php-5.6.8.tar.bz2
二、进行软件依赖包安装
[root@localhost php-5.6.8 ]# yum -y install gd curl curl-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetypedevel libxml2 libxml2-devel
三、进行PHP参数预编译
[root@localhost php-5.6.8]# ./configure
--prefix=/usr/local/php5
--enable-fpm
--enable-debug
--with-gd
--with-jpeg-dir -with-png-dir
--with-freetype-dir
--enable-mbstring
--with-curl
--with-mysql=/usr/local/mysql55/
--with-mysqli=/usr/local/mysql55/bin/mysql_config
--with-config-file path=/usr/local/php5/etc
回显以下内容为预编译通过
+-------------------------------------------------------------------------+ | License: | | This software is subject to the PHP License, available in this | | distribution in the file LICENSE. By continuing this installation | | process, you are bound by the terms of this license agreement. | | If you do not agree with the terms of this license, you must abort | | the installation process at this point. | +------ ------------------------------------------------------------------+ Thank you for using PHP.
四、编译和安装
[root@localhost php-5.6.8]# make -j4 && make install
五、PHP配置文件拷贝
cp php.ini-development /usr/local/php5/lib/php.ini #php 配置文件php.ini拷贝 php目录 #php.ini-development #官方建议开发使用php.ini 配置文件 #php.ini-production #官方建议生产环境使用php.ini 配置文件 cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf #php-fpm.conf.default PHP进程管理配置文件拷贝 cp /usr/src/php-5.6.9/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm #init.d.php-fpm #PHP进程管理器启动的脚本文件
六、对php-fpm增加执行权限以及系统服务
[root@localhost php-5.6.8]# chmod 755 /etc/init.d/php-fpm [root@localhost php-5.6.8]# chkconfig --add php-fpm [root@localhost php-5.6.8]# chkconfig php-fpm on
七、查看php-fpm进程
[root@localhost /]# ps -ef|grep php-fpm root 1275 1 0 22:05 ? 00:00:00 php-fpm: master process (/usr/local/php5/etc/php-fpm.conf) nobody 1277 1275 0 22:05 ? 00:00:00 php-fpm: pool www nobody 1278 1275 0 22:05 ? 00:00:00 php-fpm: pool www