php-5.6.29安装(centos6.8-minimal/nginx-1.8.1)
准备工作
1.yum安装所需软件包
# yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers1
2.yum源没有libmcrypt包,采用源码安装。
# cd /usr/local/src/# wget http://ncu.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz# ./configure prefix=/usr/local/libmcrypt# make && make install # echo$?12345
3.下载php源码包,解压
# wget http://am1.php.net/distributions/php-5.6.29.tar.bz2# tar jxvf php-5.6.29.tar.bz2# cd php-5.6.29123
安装过程
1.创建用户php-fpm
# useradd -s /sbin/nologin php-fpm
准备工作
1.yum安装所需软件包
# yum install -y gcc gcc-c++ make zlib zlib-devel pcre pcre-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers1
2.yum源没有libmcrypt包,采用源码安装。
# cd /usr/local/src/# wget http://ncu.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz# ./configure prefix=/usr/local/libmcrypt# make && make install # echo$?12345
3.下载php源码包,解压
# wget http://am1.php.net/distributions/php-5.6.29.tar.bz2# tar jxvf php-5.6.29.tar.bz2# cd php-5.6.29123
安装过程
1.创建用户php-fpm
# useradd -s /sbin/nologin php-fpm
3.编译和安装
# make && make install# echo $?12
4.修改配置文件
# cp php.ini-production /usr/local/php/etc/php.ini# vim /usr/local/php/etc/php-fpm.conf# /usr/local/php/sbin/php-fpm -t123
php-fpm.conf修改项如下: [global] pid = /usr/local/php/var/run/php-fpm.pid error_log = /usr/local/php/var/log/php-fpm.log [www] listen = /tmp/php-fcgi.sock user = php-fpm group = php-fpm pm = dynamic pm.max_children = 50 pm.start_servers = 20 pm.min_spare_servers = 5 pm.max_spare_servers = 35 pm.max_requests = 500 rlimit_files = 1024 运行/usr/local/php/sbin/php-fpm -t,若结果为“test is successful”,则配置正确。
5.拷贝php-fpm启动脚本到/etc/init.d/,更改权限
# cp /usr/local/src/php-5.6.29/sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm# chmod 755 /etc/init.d/php-fpm# service php-fpm start123
若使php-fpm开机启动,运行chkconfig --add php-fpm;chkconfig php-fpm on。 查看服务是否启动,运行ps aux | grep php。
转载于:https://blog.51cto.com/hhslinux/1901734