swoole / swoole-src

🚀 Coroutine-based concurrency library for PHP
https://www.swoole.com
Apache License 2.0
18.47k stars 3.16k forks source link

`undefined symbol: zend_class_serialize_deny` when starting #4598

Closed Draghmar closed 2 years ago

Draghmar commented 2 years ago

Updated to 8.1.2 on my server and got

PHP Warning:  PHP Startup: Unable to load dynamic library 'swoole.so' (tried: /usr/lib/php/modules/swoole.so (/usr/lib/php/modules/swoole.so: undefined symbol: zend_class_serialize_deny), /usr/lib/php/modules/swoole.so.so (/usr/lib/php/modules/swoole.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

When trying to do anything related to php-swoole (even php --ri swoole does that) , which is in the newest version. Not sure what's going on. It should be compatible with 8.1, right? I tried even to build Swoole again, just to be sure everything was ok with the library.

NathanFreeman commented 2 years ago

zend_class_serialize_deny function has been removed from PHP-8.1.*. Try executing make clean directive and rebuilding swoole.

Draghmar commented 2 years ago

I downloaded master with git, did phpize, ./configure, make clean, make, make install. Didn't help.

Draghmar commented 2 years ago

I also tried phpize clean but that also didn't help. I tried to build it on different machine, where swoole wasn't installed before and there was already PHP 8.1. And the result is still the same. There's really something wrong. Two machines I tried to build on, are ArchLinux based. Original machine:

Linux 5.13.10-arch1-1 #1 SMP PREEMPT Thu, 12 Aug 2021 21:59:14 +0000 x86_64 GNU/Linux
PHP 8.1.2 (cli) (built: Jan 19 2022 17:12:32) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans

Test machine:

Linux 5.14.3-arch1-1 #1 SMP PREEMPT Sun, 12 Sep 2021 20:51:34 +0000 x86_64 GNU/Linux
PHP 8.1.2 (cli) (built: Jan 19 2022 17:12:32) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
    with Xdebug v3.1.2, Copyright (c) 2002-2021, by Derick Rethans
NathanFreeman commented 2 years ago

Sorry, I can not reproduce it. There's nothing wrong with my server.

[root@iZ7xva13ausve1t1vnit98Z swoole-src]# php --ri swoole

swoole

Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 5.0.0-dev
Built => Feb  8 2022 21:49:44
coroutine => enabled with boost asm context
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
sockets => enabled
openssl => OpenSSL 1.1.1j  16 Feb 2021
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
c-ares => 1.17.2
zlib => 1.2.7
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608

Could you please show me the log when executing make directive? Thanks.

Draghmar commented 2 years ago

Here's the log when trying to build 5.0.0-dev. Funny enough, I can't even do make test because it skips all the tests because the "missing swoole.so" ;) swoole_make.log

NathanFreeman commented 2 years ago

Could you please show me the log when executing phpize and configure directive? Thanks.

Draghmar commented 2 years ago

Here you go: swoole_configure.log swoole_phpize.log

twose commented 2 years ago

If you make sure that you are using PHP-8.1.x, then when you execute phpize, you should have seen PHP Api Version: 20210902, but now it's 20200930 instead (which is PHP-8.0.x's API no). So, I guess that your system's local env has fallen into chaos. Maybe you need to re-install PHP and configure the system env correctly, after that, you can try to re-install Swoole again.

Draghmar commented 2 years ago

OMG, you were right! I don't know why, but current files are in /usr/include/php and phpize is looking in /usr/local/include/ where older files were. I didn't change anything and PHP was updated during standard system update so something must have go wrong at that level. Anyway - thanks!

veleg commented 2 years ago

Reinstalled php, installed swool: Build process completed successfully Installing '/usr/lib/php/20210902/swoole.so' Installing '/usr/include/php/20210902/ext/swoole/config.h' Installing '/usr/include/php/20210902/ext/swoole/php_swoole.h' install ok: channel://pecl.php.net/swoole-4.8.6 configuration option "php_ini" is not set to php.ini location You should add "extension=swoole.so" to php.ini added to php.ini extension=swoole.so php -m shows: PHP Warning: PHP Startup: Unable to load dynamic library 'swoole.so' (tried: /usr/lib/php/20210902/swoole.so (/usr/lib/php/20210902/swoole.so: undefined symbol: curl_ce), /usr/lib/php/20210902/swoole.so.so (/usr/lib/php/20210902/swoole.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'swoole.so' (tried: /usr/lib/php/20210902/swoole.so (/usr/lib/php/20210902/swoole.so: undefined symbol: socket_ce), /usr/lib/php/20210902/swoole.so.so (/usr/lib/php/20210902/swoole.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

leocavalcante commented 2 years ago

@veleg Please, note your error is slightly different now. Before it was:

undefined symbol: zend_class_serialize_deny

Now it is:

undefined symbol: curl_ce
undefined symbol: socket_ce

To solve this, make sure that you extension=swoole is before curl and sockets extensions. Try to move extension=swoole to the last line of your php.ini or add a custom swoole.ini at PHP's /conf.d directory.

erlandl4g commented 1 year ago

What Veleg is showing - is 2 different path references one is 20190902 and another 20210902.

Your logs say: (tried: /usr/lib/php/20190902/openswoole.so

And the /usr/lib/php/20210902

Something wrong with logs or installation.