PHP Startup: Unable to load dynamic library php_curl.dll

20,175

Solution 1

Oops, "C\php" in PATH was missing a colon. Changed it to "C:\php" and it works now. I had a feeling it would turn out to be something like this... Oh well.

Solution 2

In PHP 7.3:

  1. extension=php_curl
  2. copy libssh2.dll from C:\php into C:\apache\bin
  3. copy libcrypto-*.dll and libssl-*.dll from C:\php into C:\apache\bin (if it doesn't exist)

Solution 3

We have faced similar problem in our Environment.

We uninstalled Apache and installed it again with following commands:

c:\Apache\bin httpd -k uninstall 
c:\Apache\bin httpd -k install 

and magic.... The problem is solved...

Solution 4

In PHP 7.4:

It's a problem related to Windows, if you are using Apache2.x + Php, the trick consists in using LoadFile to force the loading of CURL as explained in my Guide. You don't need strange things or rituals to have CURL working on your machine, you only need edit httpd.conf and add this:

# load CURL library on Windows
LoadFile "${SRVROOT}/php/libssh2.dll"

Hope this helps.

Share:
20,175
Mr. Squidward
Author by

Mr. Squidward

Updated on November 20, 2020

Comments

  • Mr. Squidward
    Mr. Squidward over 3 years

    I am having trouble getting cURL working on one of my servers. I have others set up exactly like this and they are working. Here is the error message in the system log:

    PHP Fatal error: Call to undefined function curl_init()

    PHP Warning: PHP Startup: Unable to load dynamic library 'C:\php\ext\php_curl.dll' - The specified module could not be found. in Unknown on line 0

    I've been researching this all day and nothing has worked. Here's the current state of the server:

    • php.ini is in C:\php\
    • php_curl.dll is in C:\php\ext\
    • libeay32.dll and ssleay32.dll are in C:\php\
    • extension=php_curl.dll is uncommented in php.ini
    • Environment variable PATH = %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C\php;C:\php\ext;C:\Apache24\bin
    • phpinfo() shows that C:\php\php.ini is the config file being used
    • php.ini extension_dir = "C:\php\ext"
    • Apache is from here
    • PHP is from here
    • OS is Windows Server 2008 R2 Datacenter

    I've restarted several times. Other extensions are loading from the extension directory. I've also tried re-downloading the PHP zip file and replacing C:\php with the contents of the freshly downloaded zip file. I had this problem on a different server a while back when I was updating PHP and Apache. Replacing C:\php with a new copy of the zip file did fix it, but it is not helping now.

    I will be happy to provide any additional information you may need.

    Thanks.


    phpinfo() configure command

    cscript /nologo configure.js "--enable-snapshot-build" "--disable-isapi" "--enable-debug-pack" "--without-mssql" "--without-pdo-mssql" "--without-pi3web" "--with-pdo-oci=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--without-analyzer" "--with-pgo".