php 调用未定义的函数 curl_init() - 使用 WAMP

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12076641/
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 02:45:56  来源:igfitidea点击:

Call to undefined function curl_init() - with WAMP

phpwamp

提问by Rubberduck

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

我试图让 cUrl 工作,但我很难过。

I've uncommented extension=php_curl.dllin the php.inifile and checked that php_curl.dllexists in the directory that extension_dirpoints to. I've also checked that the php.iniin the Apache directory is right.

extension=php_curl.dllphp.ini文件中取消了注释并检查php_curl.dllextension_dir指向的目录中是否存在。我还检查php.ini了 Apache 目录中的 是正确的。

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

我已将libcurl.dll's复制到 Windows/System32、Windows/SysWOW64 和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_curldoes has a checkmark.

我仍然得到Fatal error: Call to undefined function curl_init(). 当我运行一个phpInfo(). 但是当我查看 WAMP 菜单时,PHP->PHP 扩展php_curl确实有一个复选标记。

Any hints?

任何提示?

Edit:

编辑:

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

@Daniel_M:加载的 ini 是 Apache 目录中的那个,并且extension=php_curl.dll已取消注释,并且extension_dir确实指向(和)php/php5.4.3/ext所在的目录。php_curl.dlllibcurl.dll

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

@ficuscr:我已经复制了libcurl.dll v.7.27.0所有地方。我应该把它放在哪里?

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

一般而言: 当在php_curl中未选中时PHP > PHP Extensions menu,致命错误前面是: SCREAM: Error suppression ignored forphp_curl检查时不会发生这种情况。两种情况下的致命错误消息都是相同的。线索?

回答by Chu Khanh Van

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.dllinto /php5.4.3/ext/.

WAMP 2.2 带有错误的 cURL 扩展。您应该从以下链接下载固定文件:
http: //www.anindya.com/php-5-4-3-and-php-5-3-13-x64-64-bit-for-windows/。然后将文件php_curl.dll替换为/php5.4.3/ext/

回答by Peter

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

单击 WAMP 图标 > PHP > PHP 扩展 > 检查 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.

如果它仍然不起作用,请重新安装 WAMP。就这么简单。

回答by gkdm

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

对我来说,这成功了:http: //www.phpmind.com/blog/2011/02/how-to-enable-curl-in-wamp/

1) Close WAMP (if running)

1)关闭WAMP(如果正在运行)

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

2)导航到 WAMP\bin\php(您的 php 版本)\

3) edit php.ini

3)编辑php.ini

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

4)搜索curl,取消注释extension=php_curl.dll

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

5) 导航到 WAMP\bin\Apache(您的 apache 版本)\bin\

6) edit php.ini

6)编辑php.ini

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

7)搜索curl,取消注释extension=php_curl.dll

8 ) Save both

8)同时保存

9) Restart WAMP

9)重启WAMP