Upgrading PHP 7.4 to PHP 8.0 for Zephir Parser (Unable to initialize module) - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Sunday, April 23, 2023

Upgrading PHP 7.4 to PHP 8.0 for Zephir Parser (Unable to initialize module)

php -v yeilds the following output:

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* yeilds the following output:

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

Following the documentation on Github, I run the following:

/etc/alternatives/phpize
./configure --with-php-config=/etc/alternatives/php-config
make
make install

This creates the SO in the ./modules directory and places it into the /usr/lib/php/20200930 directory.

I then vim /etc/php/8.0/cli/php.ini and add extension=zephir_parser.so before saving and closing.

Running php -v now gives me:

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

I have PHP 7.4 installed on the target machine but its not picking up the PHP 8 config? Any help appreciated.

Update: Truncated output of the make install:

libtool: install: cp ./.libs/zephir_parser.so /home/someuser/zephir

/php-zephir-parser/modules/zephir_parser.so
libtool: install: cp ./.libs/zephir_parser.lai /home/someuser/zephir/php-zephir-parser/modules/zephir_parser.la
libtool: finish: PATH="/root/.nvm/versions/node/v18.7.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/sbin" ldconfig -n /home/someuser/zephir/php-zephir-parser/modules
[...]
Installing shared extensions:     /usr/lib/php/20200930/
Installing header files:          /usr/include/php/20200930/

Even putting the absolute path to the SO throws the same build version error:

extension=/usr/lib/php/20200930/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


source https://stackoverflow.com/questions/76038932/upgrading-php-7-4-to-php-8-0-for-zephir-parser-unable-to-initialize-module

No comments:

Post a Comment