简体   繁体   中英

WAMP Curl installation

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 ?

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.

I ran into the same issue and i solved it just unistalling wamp2_x64(first installed in c:\\wamp) and reinstalling wamp_x86 in the folder C:/Program Files (x86)/wamp.

That seems to solve the problem, I guess it might be a problem with the dlls for 64 bits.

The php_curl.dll in a certain package of WAMP server was the wrong file, I had the same problem, I found the correct php_curl.dll file in /wamp/bin/php/php[youversion/ext/ and replaced it and it worked. See this article: http://forum.wampserver.com/read.php?2,85716

Or even simpler, click the wamp icon in the notification area (bottom right of your screen), go through PHP > PHP extensions and click the second item 'php_curl'. Wamp will restart automatically.

Had same issue with 64 bit Windows 7. This is what worked for me.

Answered by Soren from another SO thread - CURL for WAMP

"There seems to be a bug somewhere. If you are experiencing this on Win 7 64 bit then try installing apache addon version 2.2.9 and php addon version 5.3.1 and switching to those in WAMP and then activating the CURL extension. That worked for me."

I had the same problem with Wampserver 2.2 (64 bit). Here's what I did to get it working:

1) Go to wampserver->PHP->PHP extensions, enable the php_curl extension

2) Open \\bin\\php\\php5.3.13\\php.ini and uncomment the following line: extension=php_curl.dll

3) Go to \\bin\\php and copy libeay32.dll and ssleay32.dll into your windows\\system32 folder

4) If you try and restart wampserver's services, you'll notice that lib_curl still doesn't work. Turns out that the version of php_curl.dll bundled in the pack is not compiled correctly.

Apache's error log contained the following:

: PHP Startup: Unable to load dynamic library :PHP启动:无法加载动态库

'c:/wamp/bin/php/php5.3.13/ext/php_curl.dll' - The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.

5) You'll need a properly compiled version of php_curl.dll. I downloaded php_curl-5.3.13-VC9-x64.zip from this blog post:

[www.anindya.com]

Direct link:

[www.mediafire.com]

I replaced php_curl.dll inside \\bin\\php\\php5.3.13\\ext with the one above, and everything worked fine smiling smiley 6) To test if the cURL extension is working for you, try this code snippet

`

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
'http://news.google.com/news?hl=en&topic=t&output=rss');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec ($ch);
echo $contents;
curl_close ($ch);
?>

`

Here's another post with similar info (I found this after I wrote these instructions): [www.o3n.org]

if you have already uncommented line from php.ini and still getting error than you should make sure that this extension file is exists in php folder or not

so check for this file

php_curl.dll

in

{wamp}\\bin\\php\\php5.xx\\ext\\

if it's not there than download it from internet and paste it to there

Restart Apache.

  • download curl for windows ( http://curl.haxx.se/download.html )
  • Paste the zip file content into C:\\wamp\\bin\\apache\\apache2.2.x
  • Locate and open your php.ini file (resides in C:\\wamp\\bin\\php\\php5.x)
  • In your php.ini file, change/ uncomment the following line: ;extension=php_curl.dll (you do so by removing the semi-colon)
  • restart Apache or the whole server to enjoy

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM