30

I'm trying to get cUrl to work, and I'm stumped.

I've uncommented extension=php_curl.dll in the php.ini file and checked that php_curl.dll exists in the directory that extension_dir points to. I've also checked that the php.ini in the Apache directory is right.

I've copied the libcurl.dll's to Windows/System32, Windows/SysWOW64 and wamp\bin\php\php5.4.3

And I've restarted the services every time.

And still I get the Fatal error: Call to undefined function curl_init(). Curl doesn't show up when I run a phpInfo(). But when I look in the WAMP-menu PHP->PHP extensions php_curl does has a checkmark.

Any hints?

Edit:

@Daniel_M: The loaded ini is the one in the Apache directory, and extension=php_curl.dll has been uncommented, and extension_dir does point to the php/php5.4.3/ext directory where the php_curl.dll (and libcurl.dll) are located.

@ficuscr: I've copied the libcurl.dll v.7.27.0 all over the place. Where should I place it?

In general: When php_curl is unchecked in the PHP > PHP Extensions menu, the fatal error is preceeded by: SCREAM: Error suppression ignored for. This doesn't happen when php_curl is checked. The fatal error message is the same in either case. A clue?

Rubberduck
  • 1,107
  • 2
  • 13
  • 26
  • 2
    I think you're editing the wrong `php.ini`. You can see the loaded ini file in `phpinfo();` – Daniel M Aug 22 '12 at 15:37
  • Probably missing libcurl dependencies. PHP 5+ requires a libcurl version 7.10.5 or greater. – ficuscr Aug 22 '12 at 15:40
  • Going with Daniel on this. Also check `extension_dir` in your phpinfo output. No need to guess where PHP is looking. – ficuscr Aug 22 '12 at 15:44
  • I got the same error and this SO link helped me solve the issue : http://stackoverflow.com/questions/16234239/call-to-undefined-function-curl-init-error-with-wamp – Basher51 Nov 24 '13 at 03:52

3 Answers3

88

WAMP 2.2 comes with a wrong cURL extension. You should download the fixed file from the following link:
http://www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/. Then replace the file php_curl.dll into /php5.4.3/ext/.

MC Emperor
  • 22,334
  • 15
  • 80
  • 130
Khanh Van
  • 1,422
  • 11
  • 6
  • 3
    Would have loved to find this comment 5 hours ago. Many thanks. – Corey Downie Sep 13 '12 at 19:20
  • 12
    great answer! had the exact same problem and that fixed it. @Rubberduck should accept it. Just make sure to scroll down on the page to "Fixed curl extensions" – Horen Oct 02 '12 at 11:26
  • Some me a lot of time searching around for the fix. Thanks! Agree, that this answer should be accepted. – ryanpitts1 Oct 12 '12 at 21:29
  • Thanks! One wonders why this problem has still not been fixed in the distribution.... – fool4jesus Dec 26 '12 at 23:21
  • After spending hours in restarting wamp and copy-pasting dlls here and there, finally solved with this. Thanks!! – DexTer Dec 28 '12 at 01:36
  • After reading hundreds of answers "Enable the cURL extension by uncommenting the `extension=php_curl.dll` entry in the **php.ini** file", it has finally been solved for me this way! – MC Emperor Jan 03 '13 at 16:32
  • This is the correct solution. After a ton of digging around this was the fix that worked. – Jeremy Gehrs May 15 '13 at 00:26
  • 1
    Thanx for saving lot of hours. Works perfectly. having 5.3.13 version. 1st copied php_curl-5.3.13-nts-VC9-x64 and it didn't worked the replaced php_curl-5.3.13-VC9-x64....and whoi..la.... it worked. Though, i do not know difference. If some one can enlighten it. – TechCare99 May 18 '13 at 07:56
  • Simply replacing `(wamp_folder)\bin\php\php5.3.13\ext\php_curl.dll` with the downloaded one solved that problem (after enabling curl extension in php.ini) - Thanks you! – Shahar Mar 02 '14 at 10:00
  • 1
    @TechCare99 I had the same issue. It worked for me too. – felipe.zkn Jun 18 '14 at 23:12
  • How about a fix for PHP version 7.3.8...? – Stefan Nov 07 '19 at 08:40
14

Click on WAMP Icon > PHP > PHP Extensions > check php_curl.

If it's checked uncheck it, check it again, and Restart all services. Should work.

If it still not working reinstall WAMP. Simple as it is.

Peter
  • 16,453
  • 8
  • 51
  • 77
  • 4
    Doesn't he say he tired that in last paragraph? – ficuscr Aug 22 '12 at 15:39
  • Interesting.. I tried to uncheck it and check it again, just for kicks. When I "unchecked" it, the service appeared to restart, but when I went into the Extensions menu, php_curl was still checked (therefore the airquotes). When I tried again, I got an error message: "Could not execute menu item (internal error) [EAccessViolation] Access violation at address 00403A56 in module 'wampmanager.exe'. Read of address 84104888", but the checkmark did disappear. – Rubberduck Aug 23 '12 at 07:52
  • Finally I tried checking it again. Still had to do it a couple of times before the checkmark actually appeared. And it still doesn't work. – Rubberduck Aug 23 '12 at 07:58
  • did you just try to reinstall wamp? – Peter Aug 23 '12 at 08:16
8

For me this did the trick: http://www.phpmind.com/blog/2011/02/how-to-enable-curl-in-wamp/

1) Close WAMP (if running)

2) Navigate to WAMP\bin\php(your version of php)\

3) edit php.ini

4) Search for curl, uncomment extension=php_curl.dll

5) Navigate to WAMP\bin\Apache(your version of apache)\bin\

6) edit php.ini

7) Search for curl, uncomment extension=php_curl.dll

8 ) Save both

9) Restart WAMP

gkdm
  • 2,375
  • 4
  • 21
  • 27
  • 1
    Thanks man, this helped me. I didn't know that php.ini within WAMP is duplicated... which wasted 2 hours of my time -_- – LihO Aug 06 '13 at 22:09
  • 1
    In my windows, the two files are linked. When I edit one, the other one is also automatically edited. – Stefan Nov 07 '19 at 08:53