views:

25

answers:

2

I have uncomment the following from the php.ini file

;extension=php_bz2.dll
extension=php_curl.dll
;extension=php_dba.dll

Also ,I have copied the php_curl.dll to windows\system32 and restart the apache server.

I am testing the follwoing script

<?php

$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://example.com');
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);

if (empty($buffer))
{
    print "Sorry, example.com are a bunch of poopy-heads.<p>";
}
else
{
    print $buffer;
}
?>

and getting the following error

Fatal error: Call to undefined function curl_init() in C:\wamp\www\t.php on line 3

any help will be appreciated ?

A: 

Make sure that you have uncommented the extension from the right php.ini file. You should check whether or not extension is enabled through phpinfo() command.

Sarfraz
This sloved my problem 1.Stop WAMP completely.2.Find your WAMP folder: C:\Path\To\WAMP\bin\Apache\ApacheVersion\bin\3.Edit that php.ini and uncomment extension=php_curl.dll4.Restart WAMP.That should hopefully solve it.
Huzaifa
@Huzaifa: Ok that is good news :)
Sarfraz
But still i dont understand why i have to make changes into 2 php.ini instead it should the one in php folder? why the wamp installation is picking php.ini from apache folder
Huzaifa
@Huzaifa: It is one ini file, you have to figure out which one it is actually.
Sarfraz
so can i find which one the really one then ?
Huzaifa
@Huzaifa: Yes change some setting restart the server, if change affected, it means that was the right file not otherwise.
Sarfraz
This trial and error. Is there a definite way of finding it
Huzaifa
A: 

this sloved my problem

1.Stop WAMP completely. 2.Find your WAMP folder: C:\Path\To\WAMP\bin\Apache\ApacheVersion\bin\ 3.Edit that php.ini and uncomment extension=php_curl.dll 4.Restart WAMP. That should hopefully solve it.

Huzaifa