Call to undefined function curl_init() error in wamp 2.2

早过忘川 提交于 2019-11-26 19:43:08

问题


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.

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.


回答1:


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 :




回答2:


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.




回答3:


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.




回答4:


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.

edit

look at this question also

PHP and CURL under Windows 7 64 bits and Apache




回答5:


download this file and replace your php_curl file.

http://pan.baidu.com/share/link?shareid=256509&uk=3675208906




回答6:


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



  • 回答7:


    (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)




    回答8:


    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




    回答9:


    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.



    来源:https://stackoverflow.com/questions/12380670/call-to-undefined-function-curl-init-error-in-wamp-2-2

    易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
    该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!