wordpress默认的php版本为5.3,为了安全性和速度,最好升级到php5.6或7.*。
考虑到兼容性,我选择升级到5.6。
1.首先,查看PHP版本。
[root@vultr ~]# php -v PHP 5.3.3 (cli) (built: Mar 22 2017 12:27:09) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
2.根据操作系统版本安装更新包。
对于cent os 5
rpm -Uvh http://mirror.webtatic.com/yum/el5/latest.rpm
对于cent os 6
rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm
对于cent os 7
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
3.删除旧版本php并安装新版本php
yum remove php-commonyum install -y php56w php56w-opcache php56w-xml php56w-mcrypt php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring
4.确认php版本已更新为5.6
[root@vultr ~]# php -v PHP 5.6.37 (cli) (built: Jul 20 2018 18:40:47) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologieswith Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
5.重新启动apache服务以应用更新
/etc/init.d/httpd restart