Getting cURL to work on PHP 5.6 for Windows

Apparently, it can be very hard to get the popular cURL extension running properly with PHP 5.6+ if you’re unfortunate enough to be running Windows. I had already discovered the discomfort of trying to install PHP 5.6.11 on WAMPserver so I could run Laravel 5 apps, but I didn’t foresee the problems I’d run into with cURL down the road.

Trying to run cURL in PHP yielded the following error:

Call to undefined function curl_init()

This led me to the PHP Error Log, which showed me that, while php_curl.dll was uncommented in my PHP.ini, it wasn’t be successfully loaded when I started up PHP:

PHP Warning: PHP Startup: Unable to load dynamic library ‘C:\wamp\bin\php\php5.6.11\ext\php_curl.dll’ – The specified module could not be found.
in Unknown on line 0

Half an hour of annoyed Googling eventually led to a comment on the PHP documentation, which stated that the following steps should be carried out to enable cURL on PHP 5.6:

I had to also also copy libssh2.dll into my Apache24 folder for this to work with my PHP 5.6.2 installation. So altogether I had to do the following:

Move to Windows\system32 folder:
libssh2.dll, php_curl.dll, ssleay32.dll, libeay32.dll

Move to Apache24\bin folder

Uncomment extension=php_curl.dll

After copying the DLLs to their respective locations in my Wamp install and the System32 folder, I restarted Wamp and everything magically worked. Hopefully this saves you some of my frustration.

2 thoughts on “Getting cURL to work on PHP 5.6 for Windows

Leave a Reply

Your email address will not be published. Required fields are marked *