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

Sasha picture Sasha · Sep 4, 2017 · Viewed 13.3k times · Source

I am having a strange error (system is 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.ini I 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.co but the error is still there).

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

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.

Answer

Tiago Hillebrandt picture Tiago Hillebrandt · Sep 4, 2017

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

extension=curl.so

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

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

$ sudo phpenmod curl

Finally, you may need to restart your Apache:

$ sudo systemctl restart apache2