PHP启动:动态库加载失败(PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php7/lib/php/ext...

本文记录了一次在Linux环境下解决PHP扩展加载失败的问题过程。主要问题是由于未正确配置扩展库的符号链接导致部分扩展无法加载。文章详细描述了错误信息及最终解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

  今天在linux上面智障一般搞了好久,本来想安装个swoole的,然后用  php -m 的命令想看下安装的PHP扩展库,发现有的扩展库有的可以出来,有的加载失败,

  加载失败的错误类型:

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/memcached.so' - /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/memcached.so: undefined symbol: zend_new_interned_string in Unknown on line 0

  如下:

[root@pys /]# php -m
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/memcached.so' - /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/memcached.so: undefined symbol: zend_new_interned_string in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/swoole.so' - /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/swoole.so: undefined symbol: zend_new_interned_string in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/redis.so' - /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/redis.so: undefined symbol: zend_new_interned_string in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/curl.so' - /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/curl.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 '/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/fileinfo.so' - /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/fileinfo.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 '/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/gd.so' - /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/gd.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 '/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/json.so' - /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/json.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 '/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/phar.so' - /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/phar.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 '/usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/zip.so' - /usr/local/php7/lib/php/extensions/no-debug-non-zts-20151012/zip.so: cannot open shared object file: No such file or directory in Unknown on line 0
[PHP Modules]
bz2
calendar
Core
ctype
date
ereg
exif
filter
ftp
gettext
gmp

 上面的意思是 :找不到扩展库的路径; 这是为什么尼?不是有的扩展库也可以出来吗?

然后我是百度上找各种答案,并不能解决我的问题,最后自己发现问题所在:

因为我并没有为所有的扩展库加了快捷链接,以为在哪里只要用  php -m 的命令就可以查看所有的扩展库。

其实是要:/usr/local/php7/bin/php  -m  这个命令才可以,我的是PHP7.0版本的,其他版本自己换下这个路径就好。

如此,就可以看到所有的扩展库了:

[root@pys bin]# /usr/local/php7/bin/php -m 
[PHP Modules]
bcmath
Core
ctype
curl
date
dom
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mcrypt
memcached
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
redis
Reflection
session
shmop
SimpleXML
soap
sockets
SPL
sqlite3
standard
swoole
sysvsem
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
zip
zlib

[Zend Modules]

转载于:https://www.cnblogs.com/pyspang/p/7922617.html

[root@yfw ~]# cd /www/wwwroot/szrengjing.com/chat [root@yfw chat]# php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" PHP: syntax error, unexpected '(' in /www/server/php/56/etc/php-cli.ini on line 883 PHP Warning: PHP Startup: Unable to load dynamic library '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/modulename.extension' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/modulename.extension: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.dll' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.dll: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.so' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.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 '/path/to/extension/msql.so' - /path/to/extension/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: copy(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in Command line code on line 1 Warning: copy(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in Command line code on line 1 PHP Warning: copy(): Failed to enable crypto in Command line code on line 1 Warning: copy(): Failed to enable crypto in Command line code on line 1 PHP Warning: copy(https://getcomposer.org/installer): failed to open stream: operation failed in Command line code on line 1 Warning: copy(https://getcomposer.org/installer): failed to open stream: operation failed in Command line code on line 1 [root@yfw chat]# php composer-setup.php PHP: syntax error, unexpected '(' in /www/server/php/56/etc/php-cli.ini on line 883 PHP Warning: PHP Startup: Unable to load dynamic library '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/modulename.extension' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/modulename.extension: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.dll' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.dll: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.so' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.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 '/path/to/extension/msql.so' - /path/to/extension/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0 Could not open input file: composer-setup.php [root@yfw chat]# php composer.phar require ratchet/ratchet:0.3.6 PHP: syntax error, unexpected '(' in /www/server/php/56/etc/php-cli.ini on line 883 PHP Warning: PHP Startup: Unable to load dynamic library '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/modulename.extension' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/modulename.extension: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.dll' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.dll: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.so' - /www/server/php/56/lib/php/extensions/no-debug-non-zts-20131226/msql.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 '/path/to/extension/msql.so' - /path/to/extension/msql.so: cannot open shared object file: No such file or directory in Unknown on line 0 Could not open input file: composer.phar [root@yfw chat]# 报错了吧
最新发布
07-16
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值