PHP 启动:无法加载动态库`curl.so` Ubuntu

Posted

技术标签:

【中文标题】PHP 启动:无法加载动态库`curl.so` Ubuntu【英文标题】:PHP Startup: Unable to load dynamic library `curl.so` Ubuntu 【发布时间】:2017-03-14 09:16:16 【问题描述】:

php 警告:PHP 启动:无法加载动态库 '/usr/lib/php/20131226/curl.so' - /usr/lib/php/20131226/curl.so: 未定义符号:第 0 行 Unknown 中的 zend_unset_property

我使用的是 Ubuntu 14.04 LTS 和 PHP v5.6

同一台机器php5php7还有其他版本,但php5.6已经启用。我尝试通过

安装 cURL
sudo apt-get install php5.6-curl

现在我明白了

无法加载动态库curl.so

运行php -i | grep ini 后,我得到以下信息

root@ubuntu:/etc/php/5.6/apache2# php -i | grep ini
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20131226/curl.so' - /usr/lib/php/20131226/curl.so: undefined symbol: zend_unset_property in Unknown on line 0
Configuration File (php.ini) Path => /etc/php/5.6/cli
Loaded Configuration File => /etc/php/5.6/cli/php.ini
Scan this dir for additional .ini files => /etc/php/5.6/cli/conf.d
Additional .ini files parsed => /etc/php/5.6/cli/conf.d/10-mysqlnd.ini,
/etc/php/5.6/cli/conf.d/10-opcache.ini,
/etc/php/5.6/cli/conf.d/10-pdo.ini,
/etc/php/5.6/cli/conf.d/15-xml.ini,
/etc/php/5.6/cli/conf.d/20-calendar.ini,
/etc/php/5.6/cli/conf.d/20-ctype.ini,
/etc/php/5.6/cli/conf.d/20-curl.ini,
/etc/php/5.6/cli/conf.d/20-dom.ini,
/etc/php/5.6/cli/conf.d/20-exif.ini,
/etc/php/5.6/cli/conf.d/20-fileinfo.ini,
/etc/php/5.6/cli/conf.d/20-ftp.ini,
/etc/php/5.6/cli/conf.d/20-gettext.ini,
/etc/php/5.6/cli/conf.d/20-iconv.ini,
/etc/php/5.6/cli/conf.d/20-json.ini,
/etc/php/5.6/cli/conf.d/20-mbstring.ini,
/etc/php/5.6/cli/conf.d/20-mysql.ini,
/etc/php/5.6/cli/conf.d/20-mysqli.ini,
/etc/php/5.6/cli/conf.d/20-pdo_mysql.ini,
/etc/php/5.6/cli/conf.d/20-phar.ini,
/etc/php/5.6/cli/conf.d/20-posix.ini,
/etc/php/5.6/cli/conf.d/20-readline.ini,
/etc/php/5.6/cli/conf.d/20-shmop.ini,
/etc/php/5.6/cli/conf.d/20-simplexml.ini,
/etc/php/5.6/cli/conf.d/20-sockets.ini,
/etc/php/5.6/cli/conf.d/20-sysvmsg.ini,
/etc/php/5.6/cli/conf.d/20-sysvsem.ini,
/etc/php/5.6/cli/conf.d/20-sysvshm.ini,
/etc/php/5.6/cli/conf.d/20-tokenizer.ini,
/etc/php/5.6/cli/conf.d/20-wddx.ini,
/etc/php/5.6/cli/conf.d/20-xmlreader.ini,
/etc/php/5.6/cli/conf.d/20-xmlwriter.ini,
/etc/php/5.6/cli/conf.d/20-xsl.ini
user_ini.cache_ttl => 300 => 300
user_ini.filename => .user.ini => .user.ini
init_command_executed_count => 0
init_command_failed_count => 0
com_init_db => 0
Classes => AppendIterator, ArrayIterator, ArrayObject, BadFunctionCallException, BadMethodCallException, CachingIterator, CallbackFilterIterator, DirectoryIterator, DomainException, EmptyIterator, FilesystemIterator, FilterIterator, GlobIterator, InfiniteIterator, InvalidArgumentException, IteratorIterator, LengthException, LimitIterator, LogicException, MultipleIterator, NoRewindIterator, OutOfBoundsException, OutOfRangeException, OverflowException, ParentIterator, RangeException, RecursiveArrayIterator, RecursiveCachingIterator, RecursiveCallbackFilterIterator, RecursiveDirectoryIterator, RecursiveFilterIterator, RecursiveIteratorIterator, RecursiveRegexIterator, RecursiveTreeIterator, RegexIterator, RuntimeException, SplDoublyLinkedList, SplFileInfo, SplFileObject, SplFixedArray, SplHeap, SplMinHeap, SplMaxHeap, SplObjectStorage, SplPriorityQueue, SplQueue, SplStack, SplTempFileObject, UnderflowException, UnexpectedValueException

这是真正的警告

PHP 警告:PHP 启动:无法加载动态库 '/usr/lib/php/20131226/curl.so' - /usr/lib/php/20131226/curl.so: 未定义符号:第 0 行 Unknown 中的 zend_unset_property

还检查了 cURL 是否不起作用。任何形式的帮助都将受到高度赞赏。

【问题讨论】:

有人知道版本列表吗 - 刚刚升级到 curl 7.65.3 【参考方案1】:

更新 php5.6(-common) 到更新的版本。这可以使用apt-get update && apt-get upgrade 来完成。您刚刚将 php5.6-curl 更新到最新版本,但它取决于更新的 php5.6。

【讨论】:

完美 :) 给我带来了真正的问题! apt-get update && apt-get install php5.6-common 帮了我大忙(它升级了 php5.6-cliphp5.6-common【参考方案2】:

如果有人遇到与 php 7.0 相同的问题。 我用sudo apt-get remove "curl" 删除了旧的“curl”,并用sudo apt-get install php7.0-curl 安装了php 7.0 的版本。

消息现已消失,一切正常。

【讨论】:

谢谢!但是有必要去掉卷曲吗?我可以安装 php7.4-curl。 sudo apt remove curl 删除curl,然后用sudo apt install php-curl 安装它而不指定版本对我来说就足够了。使用 sudo apt list *curl* 我可以看到有 2 个包:php-curl 和 php7.2-curl。【参考方案3】:

在 php7 上同样的问题。刚刚做了一个apt-get dist-upgrade,现在警告消失了,curl 工作正常。希望对您有所帮助!

【讨论】:

以上是关于PHP 启动:无法加载动态库`curl.so` Ubuntu的主要内容,如果未能解决你的问题,请参考以下文章

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

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

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

PHP启动:无法加载动态库

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

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