一、下載源碼包后,進行解壓
[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