Enable Curl on Xampp

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!

Note: Post is imported from my writings here … there may be some comments there that are helpful!

8 thoughts on “Enable Curl on Xampp”

  1. Hi Jacob
    Thanks for posting the fix!
    I checked on my XAMPP but the only place I see a php.ini is on the xampp/php folder. I am wondering if now those files might be called something else.
    Please let me know. You fix seems to be the easiest around..
    tks
    bellir

  2. hi you.
    i installed a plugin public 2 fm then active it.but it error.
    Warning: curl_exec() has been disabled for security reason
    please help me.
    info my hosting
    Apache version 2.2.22
    PHP version 5.3.10
    MySQL version 5.1.61-cll
    how to Enable Curl on my hosting.thanks a lot

  3. Hi Jacob,

    You said you always use fresh versions of xampp. i use 3.0.12 with windows and would like to enbale curl. I found the php.ini in the php folder and removed the semicolon there but there is no php.ini in apache/bin and i still get call to undefined function when i want to do a http_get(). Have you possibly got any idea how to enable curl on my version?

Comments are closed.