WAMP卷曲安装

Gai*_*ter 9 php apache curl wamp

I have uncomment the following from the php.ini file

;extension=php_bz2.dll
extension=php_curl.dll
;extension=php_dba.dll
Run Code Online (Sandbox Code Playgroud)

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;
}
?>
Run Code Online (Sandbox Code Playgroud)

and getting the following error

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

any help will be appreciated ?

Sar*_*raz 6

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.

  • 这解决了我的问题1.完全停止WAMP.2.找到你的WAMP文件夹:C:\ Path\To\WAMP\bin\Apache\ApacheVersion\bin\3.编辑php.ini并取消注释extension = php_curl.dll 4.Restart WAMP.这应该有希望解决它. (4认同)