Using CURL in XAMPP

There appear to be a lot of misguided people on the intarwebs claiming all sorts of varying things you have to do to get CURL to work on a Windows-based XAMPP install. I’d like to clear them all up here and now.

Using CURL in XAMPP

It’s really quite simple – uncomment extension=php_curl.dll in your php.ini file, then restart Apache1.

A lot of confusion seems to stem from the fact that there are multiple php.ini files in a standard XAMPP install. This really isn’t as confusing as you’d think it would be, assuming you – and I know I’m going out on a limb here – read the documentation.

There’s a straight-forward XAMPP FAQ Entry about their php.ini stucture. For those looking for the easy fix, ignore everything but the /apache/bin/php.ini file. That’s the only one that counts, regardless of which PHP version you’re currently using.

What about all the .dll files you need? Well, you don’t need them. Everything you need to run CURL on a XAMPP install is included in the download. Stop downloading extra crap and sticking it all over your system. XAMPP knows what it needs, where it’s at, and how to use it. End of story.

This is all based on the XAMPP Basic Package for Windows, version 1.6.1, released on 4/18/2007. YMMV.

Update for XAMPP 1.7.x: As of the 1.7.0 release, the php.ini file is found in /xampp/php. When in doubt, consult the FAQ entry linked above for help. Thanks to several commenters for pointing out this change!

  1. Restarting Apache is required on both Windows and Linux whenever you make configuration changes. []

49 Responses to “Using CURL in XAMPP”

  1. Dave Bowker says:

    Many many thanks for this post. I’m currently redesigning my site and needed to use Curl locally. Great post!

  2. Frank says:

    Nice post mate! Worked a treat for me, just when I was about to start downloading .dlls and uncommenting configuration directives all over the show :) Thanks!

  3. Folkert says:

    Thanks a lot for popping up high in google with this post, saves me and i thinks lot’s of others. Url is to a post with sort of the same info.

    Thanks.

  4. Sam Potts says:

    That works perfect! Even on “lite”. I’d read about having to configure 6 files elsewhere but remove the semi colon and you’re away.

    Cheers
    Sam

  5. MyGreyGoose says:

    Thank You! That simplified what I couldn’t find anywhere else without pages of complicated instructions. Save me tons of time!

  6. Russ Timo says:

    I have spent 2 days googling around untill I found this site. Man, this is perfect fit! many thanks.

  7. Edgar Santos says:

    Thanks… I google this but there is a lot of wrong information about this topic.

  8. Thanks for the help! Worked great! Sounds like I am lucky to have found this page first :)

  9. norm says:

    ** SIMPLY RESTARTING APACHE MAY NOT BE ALL THATS NEEDED **

    I had to reboot Windows to get mine to take. – Beat my head against the wall for 2-3 hours on that before tossing in the towel and giving the machine the three-finger salute.

  10. Aveesh Kumar says:

    Thanks a lot for the simple solution. Am sooo very glad you came high on the google pagerank when i searched “PHP curl XAMPP”…cheers

    Cheers…

  11. Binu Jayaraj says:

    Million thanks.

  12. Xaratos says:

    Thank you a lot (from Italy)

  13. Dave says:

    Saved me a lot of bother! Many thanks.

  14. Internia says:

    Simply and clear, thanx a lot, great post

  15. Mouly says:

    Thanks for the solution

  16. Mike says:

    This is pure awesome. Many thanks for helping me fix curl with my xampp install. I was getting a fatal error with curl_init()

  17. Ivan says:

    Thanks very much…it was actually very simple :)

  18. ajai says:

    Thanks alot. Worked like a charm

  19. judotens says:

    it doensn’t work on my xammp =((

    please help me brothers..

    Fatal error: Call to undefined function curl_init() in D:\xampp\htdocs\test\tes.php on line 9

  20. Bruce says:

    Thanks from me too!! Just got back into working on my site and I don’t really care about learning about all the inside programming and services so your simple fix got me past this hurdle and frustration. :-)

  21. Chakri says:

    Thank you for clearing that up. That helped me!!!

  22. [...] I do a fair amount of development work on my laptop using XAMPP. I must admint that I have not read the documentation as thoroughly as I should, so I was very pleased when I found Chris Meller’s post on turning on CURL for XAMPP. [...]

  23. Mike W says:

    Thanks man! Very helpful indeed! :)

  24. Vickie B says:

    After toying with this for an hour and a half I stumbled upon your post. It took all of 45 seconds to get it running and get my local script to behave. You’re a gentleman and a scholar. Thank you.

  25. Savage says:

    Had to change the php5.ini in my php directory aswell, but it worked like a charm.
    Thanks

  26. Chris Meller says:

    The other PHP INI files XAMPP uses are only “templates” that it uses when you switch between versions (since XAMPP still bundles PHP4 as well). Unless you were switching between 4 and 5, you shouldn’t need to edit anything additional.

  27. Son says:

    Thanks, works well for me. Very simple

  28. Rick says:

    Somewhat lame question but once you know cURL is working on phpinfo(), how do you actually go about using/running it?

  29. Tetley says:

    I’ve tried this on two separate machines and it hasn’t worked. I work in IT and I’ve followed the instructions exactly, as well as other ideas from other sites. Machine rebooted and everything. When I do php info all the directorys point to the correct files. Any ideas would be welcomed.
    Cheers.

  30. Anze says:

    Thank you very much, this worked like a charm! :)

    And now I finally know in what php.ini to set up my SMTP server as well … :)

  31. James says:

    Thanks for confirming this for me, cheers.

  32. eric says:

    thanks for putting it straight!

  33. Juni says:

    Thanx a lot for such a nice and clear description.
    Great help..

  34. Gary says:

    What they said!!

    Awesome Dude!!

  35. Frances says:

    Just wanted to add that I also found I had to restart windows before it would play ball, but otherwise this works exactly as it says. Thanks for the tip!

  36. Rejean says:

    Like everybody else said, many thanks for this post, it was really helpful.
    merci beaucoup!

  37. mellomutt says:

    I probably have a different version, but the php.ini file was not in the /apache/bin/ folder. Instead, it was in /php/. I only edited that one: uncommented the curl extension and saved, restarted Apache via xampp control panel, and voila!

    This post was a big timesaver. Thank you!

  38. Peter D says:

    Chris, You da man! (like mellomutt, my php.ini was in /xampp/php)

  39. Chris Meller says:

    Thanks for pointing out that the location had changed, I’ve updated the post!

  40. matt says:

    FN genius.

    I was copying .dlls here there and everywhere. It only took one line
    “ignore everything but the /apache/bin/php.ini file”

  41. Karla says:

    Awesome!, thanks!

  42. Slavic says:

    Thanks a fraking LOOOOT.

    I was one of those guys that thought I needed to download executables, paste libraries, configure lines…

    oh — when it was all just a uncomment a line..:))

    Thank you

  43. Christine says:

    I have amended the php.ini file and the curl not supported disappeared but now zencart is giving ssl errors?

  44. satty says:

    I generally do my development work on a local windows machine with the latest version of Xampp installed. I was recently toying around with the tayst twitter feed, and was having trouble using curl with xampp.

    The problem?.. curl was not enabled by default in Xampp. You receive the following error:

    Fatal error: Call to undefined function curl_init() in C:\xampp\htdocs\tayst\twitter\index.php on line 4
    The solution? These simple steps!

    Step 1. Stop all Xampp services: Apache, Mysql, Filezilla, and Mercury.

    Step 2. Open the following files in your editor of choice. (Replace C:\xampp with the location of your xampp install)

    C:\xampp\apache\bin\php.ini
    C:\xampp\php\php.ini
    C:\xampp\php\php5.ini
    C:\xampp\php\php4\php.ini
    C:\xampp\php\php4\php4.ini
    Step 3. Find the following code in each of the files, and remove the ; (semicolon) at the beginning of the line. You will most likely see it at line 546 or line 582.

    old line – ;extension=php_curl.dll
    new line – extension=php_curl.dll
    Step 4. Start your apache services.

    See what an easy fix to curl on xampp by simply removing a few semicolons. Happy Coding!

    • Chris Meller says:

      Like I said, you only need to edit one configuration file – only one php.ini file is ever read at a time.

      Per the XAMPP FAQ that file is \xampp\php\php.ini. Editing anything else is just opening you up to more confusion in the future.

  45. Sankoch says:

    Thanks for your valuable Input.

  46. Neil says:

    If you are ever in doubt about which php.ini is actually being used, just look at the output of phpinfo() – it tells you the full path to the php.ini.

  47. Nmreddy says:

    Thanks for valuable information …

Leave a Reply

Post Meta

4-21-2007
Date
12:04 pm
Time
5800
Views
276
Words
Comments
Comment Feeds