I tried activating a script on a test wordpress blog hosted on localhost to see how the script works and I was met with this error:
Call to undefined function curl_init()…
Naturally, I fired up Google and searched for solutions. If you try searching Google using the phrase “call to undefined function curl_init()“, you’ll notice the first page filled with pages containing the exact phrase. You’ll also notice that not a single one of these pages gave a complete solution to your problem.
The most helpful suggestion you’ll get is about uncommenting from your php.ini the line that contains this: “extension=php_curl.dll“. But this alone won’t necessarily solve your problem.
I realized that I had to use another search phrase if I ever expect to find the answer that would work. I finally tried “mowes portable curl”. I use MoWeS Portable in my localhost server. Had I used Wamp, I’d have phrased it thus: “Wamp curl”. I finally got lucky with this phrase as I got myself into a page* that provided the following solution which, as far as I’m concerned, is complete. It straightened things out, got rid of the errors, and got the script working.
The Complete Solution
Requirement: Full PHP package. (SE versions do not work!)
- Stop your Apache server.
- Open your php.ini file. Uncomment the line “;extension=php_curl.dll” so that it becomes “extension=php_curl.dll” (this means you just remove the semicolon character “;”) and then save the file. My php.ini is located in D:\mowes_portable\php5. If you use XAMP or WAMP, etc., just locate the php.ini somewhere inside these directories. Check this page to see suggestions regarding where php.ini is in your webhost server.
- Find the following files from the same php5 directory.
- Copy both of these files to the apache2\bin directory.
- Start Apache
If you are not just working with your localhost server, meaning you’re using your webhost’s server and you meet the undefined function curl_init() error, and you cringe at making changes to your php files, you may have to contact your webhost’s admin and ask that their curl functionality be enabled.
*You can check out the source of my solution here.