安装路径:/application/php-7.0.18
yum install -y gcc gcc-c++
libxml2-devel、openssl-devel、curl-devel、libjpeg-devel、libpng-devel、freetype-devel、openldap-devel、libmcrypt-devel
yum -y install libxml2-devel openssl-devel curl-devel libjpeg-devel libpng-devel freetype-devel openldap-devel libmcrypt-devel
cd /tools wget http://cn2.php.net/distributions/php-7.0.18.tar.gz tar -zxf php-7.0.18.tar.gz
cd php-7.0.18 ./configure --prefix=/application/php-7.0.18 --with-mysqli --enable-mbstring --enable-fpm
需要其他功能自行添加
make && make install
ln -s /application/php-7.0.18/ /application/php
创建php命令软链接到环境变量
ln -s /application/php/sbin/* /usr/local/sbin/ ln -s /application/php/bin/* /usr/local/bin/
#引擎配置文件:php.ini cd /application/php cp /tools/php-7.0.18/php.ini-development /application/php/etc/php.ini #服务配置文件:php-fpm.conf cd /application/php/etc/ cp php-fpm.conf.default php-fpm.conf cd /application/php/etc/php-fpm.d/ cp www.conf.default www.conf
以nginx身份运行php sed -i ‘s#nobody#nginx#g‘ www.conf 开启慢查询日志 sed -i ‘s#;slowlog#slowlog#g‘ www.conf 开启邮件设置 sed -i ‘s#;php_admin_value\[sendmail_path\]#php_admin_value\[sendmail_path\]#g‘ www.conf 修改收件人 sed -i ‘s#www@my.domain#244819336@qq#g‘ www.conf 开启pid文件 sed -i ‘s#;pid#pid#g‘ /application/php/etc/php-fpm.conf 开启错误日志 sed -i ‘s#;error_log#error_log#g‘ /application/php/etc/php-fpm.conf 修改错误级别 sed -i ‘s#;log_level = notice#log_level = error#g‘ /application/php/etc/php-fpm.conf 修改文件描述符数量 sed -i ‘s#;rlimit_files = 1024#rlimit_files = 32768#g‘ /application/php/etc/php-fpm.conf 修改为异步模型 sed -i ‘s#;events#events#g‘ /application/php/etc/php-fpm.conf
php-fpm -c使用指定的引擎配置文件运行,而非默认 php-fpm -c /application/php/etc/php.ini
kill -SIGQUIT $(cat /application/php/var/run/php-fpm.pid) #平滑终止 kill -SIGINT $(cat /application/php/var/run/php-fpm.pid) #立刻终止
kill -SIGUSR2 $(cat /application/php/var/run/php-fpm.pid) #平滑重启
SIGINT, SIGTERM 立刻终止
SIGQUIT 平滑终止
SIGUSR1 重新打开日志文件
SIGUSR2 平滑重载所有worker进程并重新载入配置和二进制模块
本文出自 “这就是你的选择 | CzlunSu” 博客,请务必保留此出处http://czlun.blog.51cto.com/9876583/1945879
原文地址:http://czlun.blog.51cto.com/9876583/1945879