Why does PHP refuse to enable cURL on Windows
Credit goes to @Steven Hilder for pointing me in the right direction.
The problem was that Windows could not see libssh2.dll
, another DLL that was in PHP's directory. Copying this file to C:\Windows\SysWOW64
and C:\Windows\System32
, along with the other two DLL files from my OP (libeay32.dll
and ssleay32.dll
) worked.
I am uncomfortable with this solution though because when the time comes to update to a new PHP version I will have a harder time remembering to overwrite these DLLs with the new version.Therefore, I decided to remove all 3 DLLs from the System32
and SysWOW64
directories. Instead, I just added the PHP bin directory to the Windows' PATH variable, so that the next time the OS is looking for a missing file, it will also look in that directory. This has the added bonus that if a similar problem with another DLL occurs, it will be resolved automatically.
To add the PHP bin to Windows' PATH:
- From the
Start Menu
search bar, search for and selectAdvanced system settings
- Click
Environment Variables
. Scroll down the list of System variables to selectPath
and clickEdit...
to open the current PATH setting - Append
;C:\php
or whatever directory hasphp.exe
to the current setting (semi-colon is used to separate paths).
on windows the cURL execution wants SSL certificate. may be because of that others error is showing.
Put the below code before curl_exec(curlHandle).
//to ignore the SSL certificate in windows curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER,false);