PHP 7.3 找不到 curl

Posted

技术标签:

【中文标题】PHP 7.3 找不到 curl【英文标题】:PHP 7.3 do not find curl 【发布时间】:2021-05-24 14:07:57 【问题描述】:

我在 ma​​cOS Big Sur (11.2.1) 上使用 PHP 7.3。 输入 php -version 时,我收到以下错误消息:

    php --version                                                                                                                                                        11:12:02
PHP Warning:  PHP Startup: Unable to load dynamic library 'curl' (tried: /usr/local/lib/php/pecl/20180731/curl (dlopen(/usr/local/lib/php/pecl/20180731/curl, 9): image not found), /usr/local/lib/php/pecl/20180731/curl.so (dlopen(/usr/local/lib/php/pecl/20180731/curl.so, 9): image not found)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: /usr/local/lib/php/pecl/20180731/curl (dlopen(/usr/local/lib/php/pecl/20180731/curl, 9): image not found), /usr/local/lib/php/pecl/20180731/curl.so (dlopen(/usr/local/lib/php/pecl/20180731/curl.so, 9): image not found)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/local/lib/php/pecl/20180731/intl (dlopen(/usr/local/lib/php/pecl/20180731/intl, 9): image not found), /usr/local/lib/php/pecl/20180731/intl.so (dlopen(/usr/local/lib/php/pecl/20180731/intl.so, 9): image not found)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/local/lib/php/pecl/20180731/intl (dlopen(/usr/local/lib/php/pecl/20180731/intl, 9): image not found), /usr/local/lib/php/pecl/20180731/intl.so (dlopen(/usr/local/lib/php/pecl/20180731/intl.so, 9): image not found)) in Unknown on line 0
PHP 7.3.27 (cli) (built: Feb  4 2021 17:29:32) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.27, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.27, Copyright (c) 1999-2018, by Zend Technologies

我该如何解决这个错误? 错误的原因是什么?

【问题讨论】:

未找到。可能没有安装 curl。或者检查 php.ini 中的路径。 【参考方案1】:

我的电脑出了点问题。 当我键入 php --ini 时,我收到以下消息:

php --ini                                                                                                                                                            11:33:04
PHP Warning:  PHP Startup: Unable to load dynamic library 'curl' (tried: /usr/local/lib/php/pecl/20180731/curl (dlopen(/usr/local/lib/php/pecl/20180731/curl, 9): image not found), /usr/local/lib/php/pecl/20180731/curl.so (dlopen(/usr/local/lib/php/pecl/20180731/curl.so, 9): image not found)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: /usr/local/lib/php/pecl/20180731/curl (dlopen(/usr/local/lib/php/pecl/20180731/curl, 9): image not found), /usr/local/lib/php/pecl/20180731/curl.so (dlopen(/usr/local/lib/php/pecl/20180731/curl.so, 9): image not found)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/local/lib/php/pecl/20180731/intl (dlopen(/usr/local/lib/php/pecl/20180731/intl, 9): image not found), /usr/local/lib/php/pecl/20180731/intl.so (dlopen(/usr/local/lib/php/pecl/20180731/intl.so, 9): image not found)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/local/lib/php/pecl/20180731/intl (dlopen(/usr/local/lib/php/pecl/20180731/intl, 9): image not found), /usr/local/lib/php/pecl/20180731/intl.so (dlopen(/usr/local/lib/php/pecl/20180731/intl.so, 9): image not found)) in Unknown on line 0
Configuration File (php.ini) Path: /usr/local/etc/php/7.3
Loaded Configuration File:         /usr/local/etc/php/7.3/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.3/conf.d
Additional .ini files parsed:      /usr/local/etc/php/7.3/conf.d/ext-opcache.ini

那里已经缺少 curl 扩展。 当我查看 php.ini 时,扩展名被激活。 除非需要额外的步骤?vi /usr/local/etc/php/7.3/php.ini

这是输出:

⋊> ~ php --ini                                                                                                                                                            11:33:04
PHP Warning:  PHP Startup: Unable to load dynamic library 'curl' (tried: /usr/local/lib/php/pecl/20180731/curl (dlopen(/usr/local/lib/php/pecl/20180731/curl, 9): image not found), /usr/local/lib/php/pecl/20180731/curl.so (dlopen(/usr/local/lib/php/pecl/20180731/curl.so, 9): image not found)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'curl' (tried: /usr/local/lib/php/pecl/20180731/curl (dlopen(/usr/local/lib/php/pecl/20180731/curl, 9): image not found), /usr/local/lib/php/pecl/20180731/curl.so (dlopen(/usr/local/lib/php/pecl/20180731/curl.so, 9): image not found)) in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/local/lib/php/pecl/20180731/intl (dlopen(/usr/local/lib/php/pecl/20180731/intl, 9): image not found), /usr/local/lib/php/pecl/20180731/intl.so (dlopen(/usr/local/lib/php/pecl/20180731/intl.so, 9): image not found)) in Unknown on line 0

Warning: PHP Startup: Unable to load dynamic library 'intl' (tried: /usr/local/lib/php/pecl/20180731/intl (dlopen(/usr/local/lib/php/pecl/20180731/intl, 9): image not found), /usr/local/lib/php/pecl/20180731/intl.so (dlopen(/usr/local/lib/php/pecl/20180731/intl.so, 9): image not found)) in Unknown on line 0
Configuration File (php.ini) Path: /usr/local/etc/php/7.3
Loaded Configuration File:         /usr/local/etc/php/7.3/php.ini
Scan for additional .ini files in: /usr/local/etc/php/7.3/conf.d
Additional .ini files parsed:      /usr/local/etc/php/7.3/conf.d/ext-opcache.ini

【讨论】:

以上是关于PHP 7.3 找不到 curl的主要内容,如果未能解决你的问题,请参考以下文章

Windows上的PHP / cURL安装:“找不到指定的模块。”

PHP CURL“NSS:找不到客户端证书(未指定昵称)”问题

在带有 Netbeans 7.3 的诺基亚 SDK 2.0 中找不到 JRE

Xcode 7.3 找不到“Project-Swift.h”文件

在 docker 容器中运行时找不到 curl 命令

curl安装问题--liburl3找不到