Fatal error: Call to undefined function curl_init() Windows and Linux (Ubuntu)

Standard

If you are getting the following error while browsing any website in Windows or Linux (Ubuntu) like:

Fatal error: Call to undefined function curl_init()

then here is a simple and easy solution, for both Windows and Linux (Ubuntu) users.

For Windows

If you are having the error Call to undefined function curl_init() in Windows, then you have to simply modify a line in apache’s php.ini file.

Goto your wamp folder, which would be like:

D:\wamp\bin\apache\apache2.2.6\bin\

And open the file

php.ini

If you are unbable to find the folder of file as mentioned above, or if you are using some other server in Windows, then simply find the php.ini file located under apache folder (and not php folder), and open it in a text editor.

Find the text

extension=php_curl.dll

and remove the semi-colon at the start.

Now that line would look like:

extension=php_curl.dll

(without semi-colon on start)

Save the file, and restart your Apache Server. And the problem is solved.

For Ubuntu (Linux)

If you are having the error Call to undefined function curl_init() in Ubuntu or Linux, then you have to simply install php5-curl to make this problem resolved.

Simply goto:

System -> Administration -> Synaptic Package Manager

And find the package or software as “php5-curl“ or php curl

and install the CURL module for PHP. After successful installation, restart your Apache Server with the following command:

sudo /etc/init.d/apache2 restart

And the problem is solved.

Or

Or goto gnome-terminal, and write the following command:

sudo apt-get install php5-curl

(if php5 is not the latest php version, then find the latest php curl package and install it)

After successful installation, restart your Apache Server with the following command:

sudo /etc/init.d/apache2 restart

And the problem is solved.

17 thoughts on “Fatal error: Call to undefined function curl_init() Windows and Linux (Ubuntu)

  1. Not Working in Win7 XAMPP

    It’s working in Win7 for XAMPP. I have uncomment php_curl and restarted the server. Still it’s not working suggest me something.

  2. himanshu

    Thank you very very much i have googling so much for this issue of php.ini but now i have solve this using your article thanks again…………..

  3. Michael

    Walter, I had what sounds like the exact same problem as you but could find no help on the internet.

    I finally solved it by adding the path to the curl dll to my PATH environment variable.
    That is, I added:

    C:\Program Files\PHP\ext\

    to the windows system variable PATH, then restarted httpd.

    I already had C:\Program Files\PHP\ in my path but it seems that was not enough.

    Hope this helps you or somebody else.

    - Michael

  4. Walter

    I have Vista, Apache, PHP 5.3.8

    cUrl runs from command line

    cUrl is activated (uncommented) in the PHP.INI file
    the DLL is where all the others are

    cUrl does NOT show up in PHPINFO
    Still get “Call to undefined function: curl_init()”

    I have no idea how to fix this.

    This EXACT setup works fine on my XP Pro PC

    Anyone?

  5. STILL DOES NOT WORK

    I cannot get it to work. I’ve un-commented-out the thing in the ini file, and restarted my entire server, and all is NOT well, and it will NOT work. HELP!!

    Windows Vista

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>