php configuration error – Call to undefined function curl_init()

How to avoid Curl error in IIS Webserver

Some times the php configuration errors  lead us to a confusion.

What is Curl?

A command line tool for getting or sending files using URL syntax. The Curl is using in php as a extension . Without enabling this extension we cannot send file like xml over URL. Thats get or send data over URL address.

The php.ini file holds all the information about the php extension, by default the curl extension will be in a disabled state  in php.ini file like this

;extension=php_curl.dll

to enable the curl extension the semi column must be removed

like this  extension=php_curl.dll

How to avoid Curl configuration errors

before that, we have to look , how to identify the curl is enabled on your IIS or not.

Step1: create a new text file with the following content

<?php 

phpinfo();

?>

Step 2:Save it as test.php

Step 3: Copy this file to your IIS Virtual Directory folder

Step 4: Right click from IIS and Browse

Now you can see the php configuration details on your browser window like this

curl_phpinfo

step 5: Search for “Curl” by pressing Ctrl+F in the browser

If the “Curl_support  enabled”  line obtained , then you can confirm that curl is enabled on your IIS.

What is the exact reasons for curl errors like Call to undefined function curl_init() and How to solve?

Reason 1 :The exact reason behind this is Operating system loads invalid php.ini  file.

To avoid that you must copy the php.ini file only to Windows , php Folder ( WINNT in 2000 server)

Reason 2: The Dll file that supports curl extension

To avoid this error you must copy the  libeay32dll , ssleay32.dll which supports the curl extension , to System32, php  folder only

Remove all other php.ini , libeay32dll , ssleay32.dll from the computer .

you done.