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!
- Restarting Apache is required on both Windows and Linux whenever you make configuration changes. [↩]
Many many thanks for this post. I’m currently redesigning my site and needed to use Curl locally. Great post!
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!
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.
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
Thank You! That simplified what I couldn’t find anywhere else without pages of complicated instructions. Save me tons of time!
I have spent 2 days googling around untill I found this site. Man, this is perfect fit! many thanks.
Thanks… I google this but there is a lot of wrong information about this topic.
Thanks for the help! Worked great! Sounds like I am lucky to have found this page first
** 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.
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…
Million thanks.
Thank you a lot (from Italy)
Saved me a lot of bother! Many thanks.
Simply and clear, thanx a lot, great post
Thanks for the solution
This is pure awesome. Many thanks for helping me fix curl with my xampp install. I was getting a fatal error with curl_init()
Thanks very much…it was actually very simple
Thanks alot. Worked like a charm
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
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.
Thank you for clearing that up. That helped me!!!
[...] 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. [...]
Thanks man! Very helpful indeed!
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.
Had to change the php5.ini in my php directory aswell, but it worked like a charm.
Thanks
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.
Thanks, works well for me. Very simple
thx man
Somewhat lame question but once you know cURL is working on phpinfo(), how do you actually go about using/running it?
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.
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 …
Thanks for confirming this for me, cheers.
thanks for putting it straight!
Thanx a lot for such a nice and clear description.
Great help..
What they said!!
Awesome Dude!!
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!
Like everybody else said, many thanks for this post, it was really helpful.
merci beaucoup!
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!
Chris, You da man! (like mellomutt, my php.ini was in /xampp/php)
Thanks for pointing out that the location had changed, I’ve updated the post!
FN genius.
I was copying .dlls here there and everywhere. It only took one line
“ignore everything but the /apache/bin/php.ini file”
Awesome!, thanks!
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
I have amended the php.ini file and the curl not supported disappeared but now zencart is giving ssl errors?
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!
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.
Thanks for your valuable Input.
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.
Thanks for valuable information …