php 在 wamp 2.2 中调用未定义的函数 curl_init() 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12380670/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 03:27:29  来源:igfitidea点击:

Call to undefined function curl_init() error in wamp 2.2

phpcurlwampwampserver

提问by Shakeel

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

当我尝试使用 wamp 服务器在 Windows 7 中实现 google 和 facebook 身份验证时出现以下错误。

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

致命错误:在第 273 行调用 E:\wamp\www\mysite\protected\extensions\eauth\EAuthServiceBase.php 中未定义的函数 curl_init()

I am using,

我在用,

  • wampserver 2.2
  • php version 5.3.13
  • wampserver 2.2
  • php 版本 5.3.13

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

我也启用了 php_curl 模块。我检查了 php.ini 进行了确认,如下所示取消了注释。

;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

该代码已在 ubuntu 中与 xampp 一起使用,但在 windows 中的 wamp 中无效。我已经做了我能找到的一切。我也尝试根据对这个线程的评论,调用未定义的函数 curl_init() - 用 WAMP 替换 php_curl.dll

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

我的 phpinfo() 如下所示。 在此处输入图片说明

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

我在E:\分区安装了wamp,但是“配置文件(php.ini)路径”好像不一样,是C:\Windows。

Please help me to fix the issue.

请帮我解决这个问题。

回答by Sohail Ahmed

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 :

访问这个并在固定卷曲扩展下有一个文件:http: //www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/之后下载并替换相关文件,然后重新启动服务器。在浏览器中导航到 localhost 并确保在 Loaded Extensions 下显示 curl 扩展:

回答by Peter Drinnan

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.

对于在 Windows 7 64 位上运行 PHP 5.4.3 的 WAMP,请确保使用 php_curl-5.4.3-VC9-x64.zip 而不是 php_curl-5.4.3-nts-VC9-x64.zip。

回答by ontananza

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.dlland libssh2.dllfrom php directory to Apache bin.

在使用 PHP 5.5.31 的 Windows 7 中,在检查 php_curl.dll 扩展是否已启用(并且仍然无法正常工作)后,帮我将libeay32.dlllibssh2.dll从 php 目录复制到 Apache bin。

回答by Tim G

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

只是一个猜测 - php.ini 中的这一部分没有引用正确的位置

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

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

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.

另外,在您的 phpinfo 中查找此块,如果它不存在,则 curl 未加载(显然)。您不是在寻找匹配的版本号 - 只是为了块的存在。

curl section in phpinfo

phpinfo 中的 curl 部分

edit

编辑

look at this question also

也看看这个问题

PHP and CURL under Windows 7 64 bits and Apache

Windows 7 64位和Apache下的PHP和CURL

回答by joe

download this file and replace your php_curl file.

下载此文件并替换您的 php_curl 文件。

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

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

回答by Boris Dessy

(windows 10 user)

(Windows 10 用户)

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

由于这是 Google 中的第一个结果,我遇到了完全相同的问题,而且您的解决方案都没有对我有用,我终于在 stackoverflow 的另一个线程中找到了正确的解决方案,我将在此处发布链接: 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)

解决方案是将您当前的 PHP 目录(取决于您使用的版本)添加到 Windows 中的全局“路径”变量(如链接中所述,但您当然不需要添加所有 php 目录)

回答by volvpavl

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.inibut did not load. Resolved by replacing libs libssl-1_1-x64.dlland libcrypto-1_1-x64.dllin Apache'sbinfolder with the latest buildsof OpenSSL

在我的情况下(win7 x64 + apache 2.4 + php 7.2),curl 扩展已启用php.ini但未加载。通过更换库解决libssl-1_1-x64.dlllibcrypto-1_1-x64.dllApache的bin文件夹与最新建立的OpenSSL

回答by Roman Czachor

When using WAMP..

使用 WAMP 时..

  • You should have one file php.iniin the main PHP directory
  • 你应该php.ini在主 PHP 目录中有一个文件
  • In the php.inienable the extension extension=php_curl.dll, by removing the ;char
  • php.ini启用扩展中extension=php_curl.dll,通过删除;字符
  • The extension_dirmust look like this example: extension_dir = "D:\AMP\PHP\ext\", so not a relative path
  • extension_dir必须像这个例子:extension_dir = "D:\AMP\PHP\ext\",所以不是相对路径
  • You need to restart Apache server only once. No need to restart it many times
  • 您只需要重新启动 Apache 服务器一次。无需多次重启
  • Just make sure, you have the php_curl.dllin the extdirectory
  • 只要确保你php_curl.dllext目录中
  • 回答by AhmedMahmoud

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

    通过删除 ; 来更改 php.ini 文件中的扩展名取消注释。像下面

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

    Then restart all services and it will work.

    然后重新启动所有服务,它将起作用。