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.

No related posts.

  • Cameron Spiers

    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)

    • http://www.devilsworkshop.org Rahul Bansal

      @Cameron
      Ya. Thats right!
      Thanks for your valuable comment… :-)

    • http://www.dosspirit.net bakkelun

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

  • http://www.mayursomani.com Mayur Somani

    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.

    • http://www.devilsworkshop.org Rahul Bansal

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

  • Pingback: Best of Devils Workshop in Year 2008!()

  • Mukund

    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

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

  • Pingback: CURL with PHP and Apache on Windows | TechiePark()

  • spatan

    thanks. this was helpful

  • http://www.toonamiaftermath.com Toon

    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

    Thanks this helped me alot.

  • suresh kumar

    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

    • http://www.tokobungaalam.com bunga

      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.