openvenues / php-postal

PHP bindings to libpostal for for fast international street address parsing/normalization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

php_postal.c:141:69: error: expected ‘)’ before ‘TSRMLS_CC’

patxipierce opened this issue · comments

Ran into this today and thought I'd add it to the knowledge base, because it is a common scenario.

System: Debian
PHP version: 7.4 and 8.0

./php-postal/php_postal.c:141:69: error: expected ‘)’ before ‘TSRMLS_CC’
     expand_class_entry_ptr = zend_register_internal_class(&expand_ce TSRMLS_CC);
                                                                     ^~~~~~~~~~
                                                                     )
./php-postal/php_postal.c:144:69: error: expected ‘)’ before ‘TSRMLS_CC’
     parser_class_entry_ptr = zend_register_internal_class(&parser_ce TSRMLS_CC);
                                                                     ^~~~~~~~~~
                                                                     )

The problem is that PHP8.0 has dropped TSRMLS_* and the ./configure was run using the default PHP on this machine (8.0).
To fix the problem and install the version for 7.4 you will need to use --with-php-config:

$ sudo apt install php7.4-dev
$ ./configure --with-php-config=/usr/bin/php-config7.4
$ make

I'm having the same issue. I installed php7.4-dev and was able to install the module. But I can't seem to use it. When restarting Apache I get the following warning:

PHP Warning: PHP Startup: postal: Unable to initialize module\nModule compiled with module API=20190902\nPHP compiled with module API=20200930\nThese options need to match\n in Unknown on line 0

On PHP 8.1 this issue remains active.