php升级过程及出现的问题解决方法

  • 内容
  • 评论
  • 相关

php升级过程及出现的问题解决方法

小编网站之前php版本为5.6.4,由于网站后台一直提示php版本过低需要升级,于是直接升级至7.2.28,不过在升级的过程中真是各种问题层出不穷,现整理出来以后再出问题就容易解决了。

1.卸载旧版本php

首先通过

php -v

命令查看服务器版本号

小编是通过rpm命令手动安装的,所以通过

#rpm -qa|grep php

查看全部的php软件包

可以看到所有的安装包

php-pdo-5.6.4
php-mysql-5.6.4
php-xml-5.6.4
php-cli-5.6.4
php-common-5.6.4
php-gd-5.6.4

依次执行

rpm -e php-mysql-5.6.4
rpm -e php-pdo-5.6.4
rpm -e php-xml-5.6.4
rpm -e php-cli-5.6.4
rpm -e php-gd-5.6.4
rpm -e php-common-5.6.4

进行卸载

注意卸载的顺序

rpm -e php-common-5.6.4

最后执行

再用

php -v

可以看出没有版本号了

不过还有可能存在其他php相关的文件或文件夹

通过

whereis php

查找所有php相关的位置,通过rm -rf 命令进行一个个删除

2.升级安装php

和正常安装php步骤一样

注意编译时添加mysqli扩展

./configure --prefix=/usr/local/php --with-mysqli=mysqlnd --enable-mysqlnd --with-gd --with-openssl --enable-gd-native-ttf --enable-gd-jis-conv --enable-fpm --with-openssl

make && make install

如果提示内存不足,通过kill命令结束掉一些进行

查看进程

ps -A

3.php升级时出现的问题

sudo /usr/local/php/sbin/php-fpm

启动时报错,提示:

[11-Mar-2020 17:58:38] WARNING: Nothing matches the include pattern '/usr/local/php/etc/php-fpm.d/*.conf' from /usr/local/php/etc/php-fpm.conf at line 125.

[11-Mar-2020 17:58:38] ERROR: No pool defined. at least one pool section must be specified in config file

[11-Mar-2020 17:58:38] ERROR: failed to post process the configuration

[11-Mar-2020 17:58:38] ERROR: FPM initialization failed

解决方法:

cd /usr/local/php/etc/php-fpm.d/
cp www.conf.default www.conf

再执行一遍启动命令运行成功

一切正常后,打开WordPress后台,报错

Fatal error: Uncaught Error: Call to undefined function gzinflate() in /usr/local/nginx/html/
wp-includes/class-requests.php:947 Stack trace: #0 /usr/local/nginx/html/wp-includes/class-requests.php
(886): Requests::compatible_gzinflate('M\xC9A\n\x80 \x10\x05\xD0\xBB\xCC:$\x8A\n...') #1 
/usr/local/nginx/html/wp-includes/class-requests.php(835): Requests::compatible_gzinflate
('\x1F\x8B\x08\x00\x00\x00\x00\x00\x00\x03M\xC9A\n\x80...') #2 /usr/local/nginx/html/wp-includes/
class-requests.php(675): Requests::decompress('\x1F\x8B\x08\x00\x00\x00\x00\x00\x00\x03M\xC9A\n\x80...')
 #3 /usr/local/nginx/html/wp-includes/class-requests.php(383): Requests::parse_response(Array, 
'https://api.wor...', Array, NULL, Array) #4 /usr/local/nginx/html/wp-includes/class-http.php(393):
 Requests::request('https://api.wor...', Array, NULL, 'GET', Array) #5 /usr/local/nginx/html/
wp-includes/class-http.php(622): WP_Http->request('https://api.wor...', Array) #6 /usr/local/nginx
/html/wp-includes/http.php(164): WP_Http->get('https://api.wor...', Array) #7 in /usr/local/nginx
/html/wp-includes/class-requests.php on line 947

函数未定义,php编译时没有带上zlib扩展

重新编译php的zlib扩展就可以了。

cd /usr/local/src/php-7.2.28/ext/zlib/

cp config0.m4 m4

/usr/local/php/bin/phpize

./configure --with-php-config=/usr/local/php/bin/php-config --with-zlib

make && make install

 

IT技术资料分享-个人整理自互联网

 

上一篇: 下一篇:
关注本站微信公众号


仍未解决?点击远程协助
win10纯净版系统安装教程
关闭
关注本站

扫一扫,关注本站微信公众号