blog已经有两年时间没动过。上次把内存改成2G后,使用了1年,又出现内存不足,无法连接数据库的问题。最终解决的办法就是升级php。
先升级系统,发现update,也是把系统升级到centos 7.4
yum update
查看升级结果
# uname -a
Linux chenshake.com 3.10.0-693.11.1.el7.x86_64
#1 SMP Mon Dec 4 23:52:40 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
添加IUS的repo源,这是专门针对红帽系统提供rpm包更新的。应该是品质很高
yum install https://centos7.iuscommunity.org/ius-release.rpm
删除php
yum remove php-common mod_php php-cli
升级php7
yum install php70u php70u-pdo php70u-mysqlnd \
php70u-opcache php70u-xml php70u-gd \
php70u-devel php70u-mysql
重启httpd
systemctl restart httpd
查看结果
# php -v
PHP 7.0.26 (cli) (built: Nov 27 2017 11:26:34) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies
with Zend OPcache v7.0.26, Copyright
(c) 1999-2017, by Zend Technologies