升级PHP7.4至PHP8.0后Zephir Parser无法初始化模块求助
问题:Zephir Parser编译后与PHP 8.0.28 API版本不匹配
已将系统PHP切换至8.0.28,执行php -v输出:
PHP 8.0.28 (cli) (built: Feb 14 2023 18:32:57) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.28, Copyright (c) Zend Technologies with Zend OPcache v8.0.28, Copyright (c), by Zend Technologies
执行ls -l /etc/alternatives/*php*确认PHP相关软链接均指向8.0版本:
lrwxrwxrwx 1 root root 15 Apr 17 20:51 /etc/alternatives/php -> /usr/bin/php8.0 lrwxrwxrwx 1 root root 22 Apr 17 20:51 /etc/alternatives/php-config -> /usr/bin/php-config8.0 lrwxrwxrwx 1 root root 38 Apr 17 20:51 /etc/alternatives/php-config.1.gz -> /usr/share/man/man1/php-config8.0.1.gz lrwxrwxrwx 1 root root 31 Apr 17 20:51 /etc/alternatives/php.1.gz -> /usr/share/man/man1/php8.0.1.gz lrwxrwxrwx 1 root root 18 Apr 17 20:51 /etc/alternatives/phpize -> /usr/bin/phpize8.0 lrwxrwxrwx 1 root root 34 Apr 17 20:51 /etc/alternatives/phpize.1.gz -> /usr/share/man/man1/phpize8.0.1.gz
按照文档执行以下命令编译安装Zephir Parser:
/etc/alternatives/phpize ./configure --with-php-config=/etc/alternatives/php-config make make install
操作完成后,./modules目录生成zephir_parser.so,并被安装至/usr/lib/php/20200930目录。随后编辑/etc/php/8.0/cli/php.ini添加extension=zephir_parser.so,但执行php -v时出现警告:
PHP Warning: PHP Startup: zephir_parser: Unable to initialize module Module compiled with module API=20190902 PHP compiled with module API=20200930 These options need to match in Unknown on line 0 PHP 8.0.28 (cli) (built: Feb 14 2023 18:32:57) ( NTS ) Copyright (c) The PHP Group Zend Engine v4.0.28, Copyright (c) Zend Technologies with Zend OPcache v8.0.28, Copyright (c), by Zend Technologies
目标机器上同时安装了PHP7.4,怀疑编译模块时未使用PHP8的配置。即使指定扩展绝对路径extension=/usr/lib/php/20200930/zephir_parser.so,仍出现相同的API版本不匹配错误,求解决方法。
内容的提问来源于stack exchange,提问作者Jaquarh
相关产品推荐
相关产品推荐

