简体   繁体   中英

PHP Startup: Unable to load dynamic library php_curl.dll

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" .

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)

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.

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...

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.

Unable to load dynamic library 'C:\\php\\ext\\php_curl.dll'

correct answer should workable as environment path for c:\\php is missed . so just add

In Control Panel -> Search -> Advanced System Settings and use the button Environment Variables.

Under System Variables find Path add the c:\\php folder (or whatever path) and restart Apache.

就我而言,问题是我在 C:\\Windows\\System32 中的文件之前获取了另一个位于 PATH 中的 curl.exe 文件

also you need to change the curl.dll version, you must overwrite the version that comes with wamp server. C:/wamp/bin/php/ext.

You can download the right version from this link

http:// www.mediafire.com/download/3ay381k3cq59cm2/php_curl-5.4.3-VC9-x64.zip

I hope it works for you!

font: http://forum.wampserver.com/read.php?2,85716,85932

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM