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

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('MxC9A x80 x10x05xD0xBBxCC:$x8A …’) #1
/usr/local/nginx/html/wp-includes/class-requests.php(835): Requests::compatible_gzinflate
('x1Fx8Bx08x00x00x00x00x00x00x03MxC9A x80…’) #2 /usr/local/nginx/html/wp-includes/
class-requests.php(675): Requests::decompress('x1Fx8Bx08x00x00x00x00x00x00x03MxC9A 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

想了解更多关于php升级过程及出现的常见问题和解决方法的内容,请扫微信
或微信搜索jiemingpan

本文链接:http://www.soufuzi.com/jianzhan/3148

(0)
上一篇 2025-05-27 23:41:41
下一篇 2025-05-27 23:41:41

相关推荐

  • 淘宝产品照片怎么拍?

    首先要从多个角度对商品进行拍摄,包括商品正面、背面、45°角与内部结构,从全方位多角度的拍摄能帮助买家深入了解商品的外观与形象。如果产品的细节做的很好,那么可以考虑是否使用微距对商品进行局部的放大拍摄。 然后商家要对商品的包装进行多角度拍摄,包括包装正面、背面与45°角,然后再将商品与商品包装组合拍摄。通过外包装展示,能够体现出品牌感或对运输中安全性的保障。 最后,可以对商品说明书、防伪标识、使用步骤等进行拍摄。

    2023-08-05 22:14:23
  • 通配符ssl多少钱?

    市场上通配符SSL证书受品牌和类型的影响,其价格参差不齐,几百、几千甚至上万的都有,验证等级越高、安全性越高、功能越强大的通配符ssl证书价格也就越贵。当然不是越贵越好,也不是越便宜越好,我们应根据网站的真实情况选择合适的验证等级和域名支持能力的通配符SSL证书,性价比是关键。

    2023-04-04 11:49:11