如何解决PECL扩展runkit7与PHP 8.0的模块版本不匹配问题?
问题:为指定PHP版本安装匹配的PECL扩展
当前环境信息
- 正在使用的PHP版本:
PHP 8.0.30 (cli) (built: Sep 2 2023 08:05:13) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.30, Copyright (c) Zend Technologies with Zend OPcache v8.0.30, Copyright (c), by Zend Technologies with Xdebug v3.4.1, Copyright (c) 2002-2025, by Derick Rethans
- PHP扩展加载路径:
/usr/lib/php/20200930/ - 服务器系统:
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 22.04.3 LTS Release: 22.04 Codename: jammy
- 已安装多个PHP版本:
$ sudo update-alternatives --list php /usr/bin/php7.4 /usr/bin/php8.0 /usr/bin/php8.1 /usr/bin/php8.2 /usr/bin/php8.3
- 软件源包含:
https://ppa.launchpadcontent.net/ondrej/php/ubuntu/
问题详情
执行以下命令安装runkit7扩展:
pecl install runkit7-4.0.0a6
但生成的runkit7.so文件被放置在/usr/lib/php/20230831/runkit7.so,直接将该文件移动到指定的扩展加载路径后,启动PHP时出现版本不匹配错误:
PHP Warning: PHP Startup: runkit7: Unable to initialize module Module compiled with module API=20230831 PHP compiled with module API=20200930 These options need to match in Unknown on line 0
请问如何为我的PHP 8.0安装版本匹配的PECL扩展?
内容的提问来源于stack exchange,提问作者k0pernikus
相关产品推荐
相关产品推荐

