laravel PHP - 无法加载动态库 '/usr/lib/php/20151012/php_curl.dll' - /usr/lib/php/20151012/php_curl.dll

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46037903/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 16:36:07  来源:igfitidea点击:

PHP - Unable to load dynamic library '/usr/lib/php/20151012/php_curl.dll' - /usr/lib/php/20151012/php_curl.dll

phplaravelcurlphp-ini

提问by Sasha

I am having a strange error (system is Ubuntu 16.04):

我有一个奇怪的错误(系统是 Ubuntu 16.04):

[Mon Sep 04 13:07:17.219992 2017] [mpm_prefork:notice] [pid 27798] AH00169: caught SIGTERM, shutting down
[Mon Sep 04 13:07:17.302181 2017] [so:warn] [pid 27874] AH01574: module php7_module is already loaded, skipping
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_curl.dll' - /usr/lib/php/20151012/php_curl.dll: cannot open shared object file: No such file or directory in Unknown on line 0
[Mon Sep 04 13:07:17.322006 2017] [mpm_prefork:notice] [pid 27875] AH00163: Apache/2.4.18 (Ubuntu) configured -- resuming normal operations
[Mon Sep 04 13:07:17.322026 2017] [core:notice] [pid 27875] AH00094: Command line: '/usr/sbin/apache2'

PHP version is 7.1.19. I installed curl (apt-get install php7.1-curl), in the php.iniI added extension=curl.co(and commented out extension=php_curl.dll), restarted the apache service, and the error is still there (I tried commenting out extension=curl.cobut the error is still there).

PHP 版本为 7.1.19。我安装了curl(apt-get install php7.1-curl),在php.ini中我添加了extension=curl.co(并注释掉了extension=php_curl.dll),重启了apache服务,错误依旧(我尝试注释掉extension=curl.co但错误仍然存​​在)。

This is an error I am getting on the page (Laravel setup):

这是我在页面上遇到的错误(Laravel 设置):

Call to undefined function App\curl_init()

Everything is installed and config files are as required and I don't know what could be wrong here.

一切都已安装,配置文件也已按要求进行,我不知道这里有什么问题。

回答by Tiago Hillebrandt

The /etc/php/7.1/mods-available/curl.inifile content should be:

/etc/php/7.1/mods-available/curl.ini文件内容应该是:

extension=curl.so

Please notice the extension is .so, and not .co.

请注意扩展名是.so,而不是.co

Then you can enable the module in your PHP by running:

然后您可以通过运行在 PHP 中启用该模块:

$ sudo phpenmod curl

Finally, you may need to restart your Apache:

最后,您可能需要重新启动 Apache:

$ sudo systemctl restart apache2