Linux多PHP如何切换系统默认PHP版本

复制代码
PHP Warning:  PHP Startup: igbinary: Unable to initialize module
Module compiled with module API=20190902
PHP    compiled with module API=20180731
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: redis: Unable to initialize module
Module compiled with module API=20190902
PHP    compiled with module API=20180731
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: SourceGuardian: Unable to initialize module
Module compiled with module API=20190902
PHP    compiled with module API=20180731
These options need to match
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'swoole.so' (tried: /www/server/php/73/lib/php/extensions/no-debug-non-zts-20180731/swoole.so (/www/server/php/73/lib/php/extensions/no-debug-non-zts-20180731/swoole.so: cannot open shared object file: No such file or directory), /www/server/php/73/lib/php/extensions/no-debug-non-zts-20180731/swoole.so.so (/www/server/php/73/lib/php/extensions/no-debug-non-zts-20180731/swoole.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
PHP Warning:  PHP Startup: fileinfo: Unable to initialize module
Module compiled with module API=20190902
PHP    compiled with module API=20180731
These options need to match
 in Unknown on line 0
Workerman[think] stop 
Workerman[think] is stopping ...
Workerman[think] stop success
You have new mail in /var/spool/mail/root,检查下提示,这是什么问题

提示如上错误,说明PHP 扩展版本与当前 PHP 版本不兼容,核心错误信息如下:

bash 复制代码
Module compiled with module API=20190902
PHP    compiled with module API=20180731
These options need to match

问题原因

  • module API=20180731 对应的是 PHP 7.3

  • module API=20190902 对应的是 PHP 7.4

那么如何切换PHP版本

bash 复制代码
# 1. 删除旧链接
rm -f /usr/bin/php

# 2. 创建新链接
ln -s /www/server/php/74/bin/php /usr/bin/php

# 3. 验证
php -v
相关推荐
UP_Continue21 小时前
Linux--进程控制
linux·运维·服务器
请输入蚊子21 小时前
«操作系统真像还原» 第二章 编写MBR主引导记录
linux·汇编·操作系统·bochs·操作系统真像还原
等什么君!21 小时前
docker -数据卷技术
运维·docker·容器
188号安全攻城狮1 天前
【PWN】HappyNewYearCTF_8_ret2csu
linux·汇编·安全·网络安全·系统安全
Yana.nice1 天前
openssl将证书从p7b转换为crt格式
java·linux
AI逐月1 天前
tmux 常用命令总结:从入门到稳定使用的一篇实战博客
linux·服务器·ssh·php
小白跃升坊1 天前
基于1Panel的AI运维
linux·运维·人工智能·ai大模型·教学·ai agent
跃渊Yuey1 天前
【Linux】线程同步与互斥
linux·笔记
杨江1 天前
seafile docker安装说明
运维
舰长1151 天前
linux 实现文件共享的实现方式比较
linux·服务器·网络