1.检查当前安装的 PHP 包
yum list installed | grep PHP
PHP.x86_64 5.4.45-53.el6.art @atomic PHP-cli.x86_64 5.4.45-53.el6.art @atomic PHP-common.x86_64 5.4.45-53.el6.art @atomic PHP-devel.x86_64 5.4.45-53.el6.art @atomic PHP-fpm.x86_64 5.4.45-53.el6.art @atomic PHP-gd.x86_64 5.4.45-53.el6.art @atomic PHP-imap.x86_64 5.4.45-53.el6.art @atomic PHP-ldap.x86_64 5.4.45-53.el6.art @atomic PHP-mbstring.x86_64 5.4.45-53.el6.art @atomic PHP-mcrypt.x86_64 5.4.45-53.el6.art @atomic PHP-mssql.x86_64 5.4.45-53.el6.art @atomic PHP-MysqL.x86_64 5.4.45-53.el6.art @atomic PHP-odbc.x86_64 5.4.45-53.el6.art @atomic PHP-pdo.x86_64 5.4.45-53.el6.art @atomic PHP-pear.noarch 1:1.9.4-4.el6 @base PHP-snmp.x86_64 5.4.45-53.el6.art @atomic PHP-soap.x86_64 5.4.45-53.el6.art @atomic PHP-tidy.x86_64 5.4.45-53.el6.art @atomic PHP-xml.x86_64 5.4.45-53.el6.art @atomic PHP-xmlrpc.x86_64 5.4.45-53.el6.art @atomic
删除上面列出来的所有已安装的包
yum remove -y PHP.x86_64 PHP-cli.x86_64 ...
2.CentOS 5.x
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
CentOS 6.x
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
CentOS 7.x
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
如果想删除上面安装的包,重新安装
rpm -qa | grep wwebstatic
remp -e
上面搜索到的包即可
3.运行yum install
yum install -y PHP55w.x86_64 PHP55w-cli.x86_64 PHP55w-common.x86_64 PHP55w-devel.x86_64 ...
注:如果想升级到5.6
,把上面的55w
换成56w
就可以了
4.配置 PHP-fpm
上面已经安装好了 PHP
和 PHP-fpm
,下面就需要重新配置一下PHP-fpm
了. 在/etc/
(根据不同的环境,所在的目录可能会不同)下找到PHP-fpm.conf
并编辑配置.最后我自己的配置如下:
[global] pid = /usr/local/PHP/var/run/PHP-fpm.pid error_log = /usr/local/PHP/var/log/PHP-fpm.log log_level = notice [www] listen = /tmp/php-cgi.sock listen.backlog = -1 listen.allowed_clients = 127.0.0.1 listen.owner = www listen.group = www listen.mode = 0666 user = www group = www pm = dynamic pm.max_children = 300 pm.start_servers = 20 pm.min_spare_servers = 10 pm.max_spare_servers = 30 pm.max_requests = 10240 #一般情况下这个值不用设置的这么大 request_terminate_timeout = 600 request_slowlog_timeout = 10 slowlog = /usr/local/PHP/var/log/slow.log
5. 重启服务
service PHP-fpm restart原文链接:https://www.f2er.com/centos/380647.html