操作系统:CentOSrelease 6.8 (Final)
虚拟机:VMware
PHP软件包:php-5.6.30.tar.gz
安装步骤如下:
[[email protected] tools]# tar zxf php-5.6.30.tar.gz
[[email protected] tools]# cd php-5.6.30
[[email protected] tools]#
wget http://cn.php.net/distributions/php-5.6.30.tar.gz
[[email protected] php-5.6.30]#yum install zlib-devel libxml2-devel libjpeg-devel libjpeg-turbo-devellibiconv-devel -y #安装相关的lib软件包
[[email protected] php-5.6.30]#yum install freetype-devel libpng-devel gd-devel libcurl-devel libxslt-devellibxslt-devel –y #安装相关的lib软件包
[[email protected] php-5.6.30]#./configure \
--prefix=/application/php-5.6.30 \
--with-mysql=/application/mysql \
--with-iconv-dir=/usr/local/libiconv \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-short-tags \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-opcache=no
设置软链接:#ln -s /application/php-5.6.30/ /application/php
拷贝PHP配置文件到PHP默认目录: cp php.ini-production /application/php/lib/php.ini
配置php-fpm.conf文件:cp php-fpm.conf.default php-fpm.conf
启动php服务php-fpm, 命令行:/application/php/sbin/php-fpm
检查php服务php-fpm的进程及端口的情况,命令如下:
[[email protected] nginx]# ps -ef|grep php-fpm
root 12228 1 0 13:42 ? 00:00:00 php-fpm: master process (/application/php-5.6.30/etc/php-fpm.conf)
nginx 12229 12228 0 13:42 ? 00:00:00 php-fpm: pool www
nginx 12230 12228 0 13:42 ? 00:00:00 php-fpm: pool www
root 12301 1708 0 14:01 pts/1 00:00:00 grep php-fpm
[[email protected] nginx]# lsof -i :9000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
php-fpm 12228 root 7u IPv4 195435 0t0 TCP localhost:cslistener (LISTEN)
php-fpm 12229 nginx 0u IPv4 195435 0t0 TCP localhost:cslistener (LISTEN)
php-fpm 12230 nginx 0u IPv4 195435 0t0 TCP localhost:cslistener (LISTEN)