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

Posted 一粒小米

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP启动:动态库加载失败(PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php7/lib/php相关的知识,希望对你有一定的参考价值。

  今天在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

  如下:

[[email protected] /]# 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版本的,其他版本自己换下这个路径就好。

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

[[email protected] 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]

以上是关于PHP启动:动态库加载失败(PHP Warning: PHP Startup: Unable to load dynamic library '/usr/local/php7/lib/php的主要内容,如果未能解决你的问题,请参考以下文章

`PHP 警告:PHP 启动:无法加载动态库 'mcrypt.so'

PHP 警告:PHP 启动:无法加载动态库 'bz2'

PHP 启动:无法加载动态库 'sqlsrv'

PHP 警告:PHP 启动:无法加载动态库

PHP 警告:PHP 启动:无法加载动态库

PHP启动:无法加载动态库