Call to undefined function curl_init() error in wamp 2.2
Asked Answered
M

9

33

I am having below error when I try to implement google and facebook authentication in windows 7 using wamp server.

Fatal error: Call to undefined function curl_init() in E:\wamp\www\mysite\protected\extensions\eauth\EAuthServiceBase.php on line 273

I am using,

  • wampserver 2.2
  • php version 5.3.13

I have enabled php_curl module as well. I checked in php.ini for confirm and it is uncommented as below.

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

The code has worked in ubuntu with xampp, but not in wamp in windows. I have done everything I can find. I have tried replacing the php_curl.dll also according to the comment on this thread, Call to undefined function curl_init() - with WAMP

My phpinfo() looks like below. enter image description here

I have installed wamp in the partition E:\, but the "Configuration File (php.ini) Path" seems different, it is C:\Windows.

Please help me to fix the issue.

Manstopper answered 12/9, 2012 at 3:4 Comment(6)
phpinfo() and check that you've modified the right config fileWaaf
have you started the php_curl extensionLeftist
@zerkms: thanks for your comment, I have checked again the loaded configuration file is correct and php_curl is un-commented alreadyManstopper
@RegisteredUser: Thanks for the comment, yes I have enbaled and started the php_curl extension.Manstopper
what is the extension dir set to in php.ini?Hochman
I got the same error and this SO link helped me solve the issue : #16234739Leger
V
64

Visit this and have a file under Fixed curl extensions: http://www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/ after download and replace related file then restart server. In browser navigate to localhost and make sure there is curl extensions showing under Loaded Extensions :

Vadnee answered 12/9, 2012 at 12:14 Comment(5)
Also make sure you get the ones at the bottome with the "Fixed Curl Extensions" the ones inside the archives dont work for some reason, it was giving me the side by side error. Thanks Dark Wish.Staircase
Hey I have the same problem and as stated above, I downloaded php_curl-5.4.3-VC9-x64.zip and copied the dll file into the ext folder within php folder of Xampp. It still gives the same error. What should I do ?Helvellyn
Yep I can confirm the ones in the large archives don't work the fixed curl ones do(the ones right at the bottom of the page)Ganges
This one worked for me (Windows 7 64bit, PHP 5.3.13) mediafire.com/download/qwgdzgccthzwc15/… Just rename/backup the old php_curl.dll and replace it with the new one, restart Wamp and should be good to go.Banal
What about PHP 7.3.8...?Luik
M
11

For WAMP running PHP 5.4.3 on Windows 7 64 bit, make sure you use php_curl-5.4.3-VC9-x64.zip NOT php_curl-5.4.3-nts-VC9-x64.zip.

Mishandle answered 8/4, 2013 at 20:30 Comment(1)
@Pacerier can only use the thread safe versions. 'nts' means Not Thread SafeTrain
T
4

In windows 7 with PHP 5.5.31 after check that php_curl.dll extension is enabled (and still doesnt working), work for me to copy libeay32.dll and libssh2.dll from php directory to Apache bin.

Tellurium answered 3/2, 2016 at 23:42 Comment(2)
To me it works just coping libssh2.dll. PHP version 7 on Windows 10. Thanks.Doctrinaire
Works for me even for PHP 5.6.30 on Windows 10 coping only libssh2.dll as @Doctrinaire said.Milium
H
1

just a guess - this section in php.ini does not reference the correct location

; Directory in which the loadable extensions (modules) reside.
extension_dir = *some value*

http://www.php.net/manual/en/ini.core.php#ini.extension-dir

edit

Also, look for this block in your phpinfo, if it's not there, curl isn't loading (obviously). You're not looking for matching version numbers - just for the block's existence.

curl section in phpinfo

edit

look at this question also

PHP and CURL under Windows 7 64 bits and Apache

Hochman answered 12/9, 2012 at 5:5 Comment(3)
Thanks Tim G, I have my "extension_dir" the correct path. which is extension_dir = "E:/wamp/bin/php/php5.3.13/ext/". But I dont have the "Curl" block in my phpinfo. what can I do? please help.Manstopper
Any clues in log files as apache starts up? check apache error log.Hochman
have you restarted apache? Are you editing the php.ini file directly? does wamp overwrite php.ini when it's starting apache? (reason I ask is that mamp uses templates and overwrites php.ini on each startup)Hochman
C
1

(windows 10 user)

Since this is the first result in Google and I had exactly the same problem and none of your solutions worked for me and I finally find the correct solution in an other thread of stackoverflow, I'll post link here : EasyPHP Devserver 16.1 Curl Win 10

The solution is to add the your current PHP directory (depend of which version you use) to your global "path" variable in windows (like explained in the link, but you don't need to add all php directorias of course)

Colleen answered 30/9, 2016 at 21:32 Comment(1)
Fixed with environment variableParallelepiped
S
0

When using WAMP..

  • You should have one file php.ini in the main PHP directory
  • In the php.ini enable the extension extension=php_curl.dll, by removing the ; char
  • The extension_dir must look like this example: extension_dir = "D:\AMP\PHP\ext\", so not a relative path
  • You need to restart Apache server only once. No need to restart it many times
  • Just make sure, you have the php_curl.dll in the ext directory
  • Slapstick answered 25/8, 2014 at 12:53 Comment(0)
    M
    0

    Not sure where to put my experience, hope it will be useful for someone.

    In my case (win7 x64 + apache 2.4 + php 7.2), curl extension was enabled in php.ini but did not load. Resolved by replacing libs libssl-1_1-x64.dll and libcrypto-1_1-x64.dll in Apache's bin folder with the latest builds of OpenSSL

    Matthia answered 2/8, 2019 at 12:42 Comment(0)
    P
    0

    For those running PHP 7+ on windows, there is no php.ini file in the php directory by default.

    You need to:

    1. create a php.ini file in your PHP directory (it should be under C:\php\, or wherever your php directory is located)
    2. Copy the content of either php.ini-development or php.ini-production into the php.ini file you've created.
    3. Finally remove the semicolon (;) before extension=curl
    Pallid answered 7/11, 2022 at 12:6 Comment(0)
    H
    -2

    Change the extention in php.ini file uncomment by removing ; like below

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

    Then restart all services and it will work.

    Hallucination answered 25/7, 2014 at 13:42 Comment(0)

    © 2022 - 2024 — McMap. All rights reserved.