Enabling CURL on Windows+PHP+Apache Machine!

PHP Logo This is for all php programmers using Windows.

If you are planning to use CURL library on PHP then you may encounter an error like below.

Fatal error: Call to undefined function curl_init() in F:projorkutfeedstrunkindex.php on line 15

I encountered above while developing orkutfeeds.

Curl is by default not enabled on PHP on Windows although it is there. So to enable this go through following steps…

  1. Locate php.ini file. Its under directory where you installed PHP. On my machine its path is: C:wampbinphpphp5.2.5php.ini
  2. Once you find that file search for extension=php_curl.dll line
  3. There you will find a semicolon (;) before above line. Just remove it and save the change. That’s it!

If you have started webserver already then, you need to restart it again so that CURL extension gets loaded.

I found this while reading notes on PHPs’ official CURL page. This was posted by Lancelot du Lac.

In case your search for extension=php_curl.dll fails you may go through the steps mentioned by Tony Spencer.

14 Comments

Cameron Spiers April 4, 2008

Also if this still doesn’t work, which for some is probably the case.

You need to move the files:
libeay32.dll
ssleay32.dll
(which are in your PHP directory) to
c:\windows\system32

(vista and XP)

Rahul Bansal April 4, 2008

@Cameron
Ya. Thats right!
Thanks for your valuable comment… 🙂

bakkelun September 17, 2010

Yes, absolutely correct! That was the issue here, thanks!

Mayur Somani December 18, 2008

Most people are using xampp instead of wamp. To enable cURL support on xampp, uncomment this line,
extension=php_curl.dll
in
whereverYouInstalledIt\xampp\apache\bin\php.ini

Note 1- In xampp installation on windows, php.ini is a found at three places,
C:\Program Files\xampp\apache\bin\php.ini
C:\Program Files\xampp\php\php.ini
C:\Program Files\xampp\php\php4\php.ini
But only the first one is relevant, still uncomment the line in every file to be on safe side 😉

Note 2- No need to move libeay32.dll and ssleay32.dll files in system32 because xampp puts them there by default.

Hope that helps.

Rahul Bansal December 20, 2008

@Mayur Somani
Thanks for help mayur. I am sure XAMPP user will find this helpful. 😉

Mukund April 17, 2009

Hi,

There is no \apache\bin\php.ini file in my apache folder inside xampp. any idea why is it so? Also, my curl_exec() function does not seem to work ever though it does not give any explicit error. I get a blank output always. Please help me in this if you have some idea why is this happening..

Rahul Bansal April 22, 2009

@Mukund
I was using WAMP at that time.
Just search for php.ini under XAMPP directory.
XAMPP may have different path for that file.

spatan September 1, 2010

thanks. this was helpful

Toon November 14, 2010

Thank you so much I had the W.S.O.D. with an error message in Drupal about the facebook connect module after migrating from my previous webhost to WAMP server and removing the “;” from extension=php_curl.dll in php.ini worked!!

Deepesh March 9, 2011

Thanks this helped me alot.

suresh kumar September 9, 2012

When I try to run include “src/facebook.php facebook php sdk I getting error “facebook needs cURL extension of php. I already enable the php_curl and remove the semicolon at php.ini . But still getting the same problem .
I tried in another ways like libeay32.dll,
ssleay32.dll put it system32. No more luck here also.
Can anyone suggest how to enable curl and how to eliminate this error.
Thanks
suresh

bunga March 14, 2013

1. create phpinfo.php file contains this code: [code] [/code] then check your curl availability (ctrl+f, type “curl”),
2 if your curl still unavailable, try to reinstall a newer php version.