swoole / phpy

Connecting the Python and PHP ecosystems together
Apache License 2.0
542 stars 44 forks source link

php extension import error (python) #60

Closed xiangyi-wang closed 3 months ago

xiangyi-wang commented 3 months ago
php -v
PHP 8.3.10 (cli) (built: Aug  2 2024 15:31:15) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.10, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.10, Copyright (c), by Zend Technologies
php --ini
Configuration File (php.ini) Path: /etc/php/8.3/cli
Loaded Configuration File:         /etc/php/8.3/cli/php.ini
Scan for additional .ini files in: /etc/php/8.3/cli/conf.d
Additional .ini files parsed:      /etc/php/8.3/cli/conf.d/10-mysqlnd.ini,
/etc/php/8.3/cli/conf.d/10-opcache.ini,
/etc/php/8.3/cli/conf.d/10-pdo.ini,
/etc/php/8.3/cli/conf.d/15-xml.ini,
/etc/php/8.3/cli/conf.d/20-calendar.ini,
/etc/php/8.3/cli/conf.d/20-ctype.ini,
/etc/php/8.3/cli/conf.d/20-curl.ini,
/etc/php/8.3/cli/conf.d/20-dom.ini,
/etc/php/8.3/cli/conf.d/20-exif.ini,
/etc/php/8.3/cli/conf.d/20-ffi.ini,
/etc/php/8.3/cli/conf.d/20-fileinfo.ini,
/etc/php/8.3/cli/conf.d/20-ftp.ini,
/etc/php/8.3/cli/conf.d/20-gettext.ini,
/etc/php/8.3/cli/conf.d/20-iconv.ini,
/etc/php/8.3/cli/conf.d/20-mbstring.ini,
/etc/php/8.3/cli/conf.d/20-mysqli.ini,
/etc/php/8.3/cli/conf.d/20-pdo_mysql.ini,
/etc/php/8.3/cli/conf.d/20-phar.ini,
/etc/php/8.3/cli/conf.d/20-posix.ini,
/etc/php/8.3/cli/conf.d/20-readline.ini,
/etc/php/8.3/cli/conf.d/20-shmop.ini,
/etc/php/8.3/cli/conf.d/20-simplexml.ini,
/etc/php/8.3/cli/conf.d/20-sockets.ini,
/etc/php/8.3/cli/conf.d/20-sysvmsg.ini,
/etc/php/8.3/cli/conf.d/20-sysvsem.ini,
/etc/php/8.3/cli/conf.d/20-sysvshm.ini,
/etc/php/8.3/cli/conf.d/20-tokenizer.ini,
/etc/php/8.3/cli/conf.d/20-xmlreader.ini,
/etc/php/8.3/cli/conf.d/20-xmlwriter.ini,
/etc/php/8.3/cli/conf.d/20-xsl.ini,
/etc/php/8.3/cli/conf.d/20-zip.ini

PHP Warning: PHP Startup: Unable to load dynamic library 'xxx.so' for example "curl"

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

phpy.call('curl_init', 'www.baidu.com') PHP Fatal error: Invalid callback curl_init, function "curl_init" not found or invalid function name in Unknown on line 0 Traceback (most recent call last): File "", line 1, in NameError: Function 'curl_init' call failed

matyhtf commented 3 months ago

检查扩展路径是否正确,文件是否存在

/usr/lib/php/20230831/curl.so.so

xiangyi-wang commented 3 months ago

路径没问题 测试了下 降级php版本就好了

xiangyi-wang commented 3 months ago

路径没问题 测试了下 降级php版本就好了

找到原因了 是embed版本不一致导致的。。