9

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 ?

hakre
  • 193,403
  • 52
  • 435
  • 836
Gainster
  • 5,481
  • 19
  • 61
  • 90

9 Answers9

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.

Sarfraz
  • 377,238
  • 77
  • 533
  • 578
  • 4
    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. – Gainster Aug 15 '10 at 07:59
  • 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 – Gainster Aug 15 '10 at 08:26
  • 1
    @Huzaifa: It is one ini file, you have to figure out which one it is actually. – Sarfraz Aug 15 '10 at 08:36
  • so can i find which one the really one then ? – Gainster Aug 15 '10 at 08:45
  • @Huzaifa: Yes change some setting restart the server, if change affected, it means that was the right file not otherwise. – Sarfraz Aug 15 '10 at 08:47
  • (With WAMP 2.4 on Windows 7 64-bit) Apache uses the php.ini file in its directory, and that's the file changed through the WAMP system-tray menu, but some applications (eg. Composer) call php.exe directly, and that uses the php.ini file in the PHP directory. So it depends what you're doing as to which file needs to be changed, as well as potentially what WAMP and OS version you're using. – Skrivener Apr 04 '14 at 17:13
4

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.

rolandaugusto
  • 49
  • 1
  • 3
4

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

Neo
  • 11,078
  • 2
  • 68
  • 79
4

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.

Snook
  • 174
  • 10
1

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."

Community
  • 1
  • 1
Abhishek Rakshit
  • 691
  • 7
  • 12
1

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:

Warning: PHP Startup: Unable to load dynamic library

'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]

Alex Onyia
  • 29
  • 2
0

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.x.x\ext\

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

Restart Apache.

Andrew Barber
  • 39,603
  • 20
  • 94
  • 123
shyammakwana.me
  • 5,562
  • 2
  • 29
  • 50
0
  • 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
krishna
  • 930
  • 1
  • 16
  • 35
-1

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.

Alex K.
  • 171,639
  • 30
  • 264
  • 288
Gainster
  • 5,481
  • 19
  • 61
  • 90