PHP unable to load php_curl.dll extension
libeay32.dll
and ssleay32.dll
have to be path-accessible for php_curl.dll
loading to succeed.
But copying them into Apache's ServerRoot
, Apache's \bin\
, Window's \System32\
, or even worse into the Windows main directory is a bad hack and may not even work with newer PHP versions.
The right way to do it is to add the PHP path to the Windows Path
variable.
- In
Control Panel -> System
click on Advanced System Settings or press WIN+R and typeSystemPropertiesAdvanced
- Click the button Environment Variables.
- Under System Variables you will find the
Path
variable. Edit it and prependC:\PHP;
to it - or whatever the path to your PHP folder is.
(Hint: If your PHP folder contains spaces likeC:\Program Files\PHP
you may need to use the short filename form here, i.e.C:\Progra~1\PHP
.) - Then fully stop Apache and start it again (a simple restart might not be enough).
Update 2017-05:
I changed the instructions above to prepend the Path variable with the PHP path instead of appending to it. This makes sure that the DLLs in the PHP path are used and not any other (outdated) versions in other paths of the system.
Update 2018-04:
If you have already chosen the wrong way and copied any of the PHP DLLs to Apache or Windows paths, then I strongly recommend that you remove them again! If you don't, you might get into trouble when you later try to update PHP. If a new PHP version brings new versions of these DLLs, but your old DLLs still linger around in system or webserver paths, these old DLLs might be found first. This will most certainly prevent the PHP interpreter from starting. Such errors can be very hard to understand and resolve. So better clean up now and remove any of the mentioned DLLs from Windows and Apache paths, if you copied them there.
(Thanks to @EdmundTam and @WasimA. for pointing out this problem in the comments!)
Update 2019-10:
Tip: To find all copies of these DLLs and check whether you might have placed them in the wrong folders, you can use the following commands in a Windows Command Prompt window:
dir c:\libeay32.dll /s
dir c:\ssleay32.dll /s
Be warned that these commands may take some time to complete as they search through the entire directory structure of your system drive C:.
Update 2020-08:
If your PHP folder contains spaces (i.e. C:\Program Files\PHP
) you may need to use the short filename form in the Path
variable at step 3 (i.e. C:\Progra~1\PHP
). Thanks to @onee for this tip!
PHP Startup: Unable to load dynamic library php_curl.dll
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.
Apache won't load php_curl.dll
In the end I had to simply copy libcrypto-1_1-x64.dll, libssh2.dll, libssl-1_1-x64.dll and nghttp2.dll from the PHP folder into the apache bin folder.
Cannot get php_curl.dll working with PHP & Apache
Switching to 32 bit versions of Apache, PHP and OpenSSL got the extension working correctly.
PHP / cURL on Windows install: The specified module could not be found.
Problem solved!
Although the error message said The specified module could not be found, this is a little misleading -- it's not that it couldn't find php_curl.dll
, but rather it couldn't find a module that php_curl.dll
required. The 2 DLLs it requires are libeay32.dll
and SSLeay32.dll
.
So, you have to put those 2 DLLs somewhere in your PATH (e.g., C:\Windows\system32
). That's all there is to it.
However, even that did not work for me initially. So I downloaded the Windows zip of the latest version of PHP, which includes all the necessary DLLs. I didn't reinstall PHP, I just copied all of the DLLs in the "ext" folder to my PHP extensions folder (as specified in the extension_dir
variable in php.ini
), and I copied the versions of libeay32.dll
and SSLeay32.dll
from the PHP download into my System32 directory.
I also did an iisreset, but I don't know if that was necessary.
How to fix PHP Warning: PHP Startup: Unable to load dynamic library 'ext\\php_curl.dll'?
As Darren commented, Apache don't understand php.ini
relative paths in Windows.
To fix it, change the relative paths in your php.ini
to absolute paths.
extension_dir="C:\full\path\to\php\ext\dir"
Related Topics
PHP Function Imagettftext() and Unicode
Getting Multiple Checkboxes Names/Id's with PHP
Convert Exponential to a Whole Number in PHP
Http Response Code After Redirect
What Is the Maximum Size of an Array in PHP
PHP File Upload Error Tmp_Name Is Empty
Why PHP Variables Start with a $ Sign Symbol
Pass a Percent (%) Sign in a Url and Get Exact Value of It Using PHP
JSON_Encode() Non Utf-8 Strings
Mysqli + Xdebug Breakpoint After Closing Statement Result in Many Warnings
Laravel - Database, Table and Column Naming Conventions
How to Set Global Environment Variables for PHP
Php: Locale Aware Number Format
Laravel 5.2 Cors, Get Not Working with Preflight Options