CentOS yum 升级php(5.4-5.5)

前端之家收集整理的这篇文章主要介绍了CentOS yum 升级php(5.4-5.5)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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

上面已经安装好了 PHPPHP-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

猜你在找的CentOS相关文章