php WAMP卷曲安装

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

WAMP Curl installation

phpapachecurlwamp

提问by Gainster

I have uncomment the following from the php.ini file

我从 php.ini 文件中取消了以下注释

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

Also ,I have copied the php_curl.dll to windows\system32 and restart the apache server.

另外,我已将 php_curl.dll 复制到 windows\system32 并重新启动 apache 服务器。

I am testing the follwoing script

我正在测试以下脚本

<?php

$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://example.com');
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);

if (empty($buffer))
{
    print "Sorry, example.com are a bunch of poopy-heads.<p>";
}
else
{
    print $buffer;
}
?>

and getting the following error

并收到以下错误

Fatal error: Call to undefined function curl_init() in C:\wamp\www\t.php on line 3

any help will be appreciated ?

任何帮助将不胜感激 ?

采纳答案by Sarfraz

Make sure that you have uncommented the extension from the right php.ini file. You should check whether or not extension is enabled through phpinfo()command.

确保您已从正确的 php.ini 文件中取消注释扩展名。您应该通过phpinfo()命令检查是否启用了扩展。

回答by Snook

Or even simpler, click the wamp icon in the notification area (bottom right of your screen), go through PHP > PHP extensions and click the second item 'php_curl'. Wamp will restart automatically.

或者更简单,单击通知区域(屏幕右下角)中的 wamp 图标,通过 PHP > PHP 扩展并单击第二项“php_curl”。Wamp 将自动重启。

回答by rolandaugusto

I ran into the same issue and i solved it just unistalling wamp2_x64(first installed in c:\wamp) and reinstalling wamp_x86 in the folder C:/Program Files (x86)/wamp.

我遇到了同样的问题,我解决了它,只是卸载 wamp2_x64(首先安装在 c:\wamp 中)并在文件夹 C:/Program Files (x86)/wamp 中重新安装 wamp_x86。

That seems to solve the problem, I guess it might be a problem with the dlls for 64 bits.

这似乎解决了问题,我想这可能是 64 位 dll 的问题。

回答by Neo

The php_curl.dll in a certain package of WAMP server was the wrong file, I had the same problem, I found the correct php_curl.dll file in /wamp/bin/php/php[youversion/ext/ and replaced it and it worked. See this article: http://forum.wampserver.com/read.php?2,85716

WAMP服务器某个包中的php_curl.dll文件错误,我遇到了同样的问题,我在/wamp/bin/php/php[youversion/ext/中找到了正确的php_curl.dll文件并替换它并且它工作. 见这篇文章:http: //forum.wampserver.com/read.php?2,85716

回答by Alex Onyia

I had the same problem with Wampserver 2.2 (64 bit). Here's what I did to get it working:

我在 Wampserver 2.2(64 位)上遇到了同样的问题。这是我为使其正常工作所做的工作:

1) Go to wampserver->PHP->PHP extensions, enable the php_curl extension

1)进入wampserver->PHP->PHP extensions,开启php_curl扩展

2) Open \bin\php\php5.3.13\php.ini and uncomment the following line: extension=php_curl.dll

2) 打开\bin\php\php5.3.13\php.ini 并取消注释以下行:extension=php_curl.dll

3) Go to \bin\php and copy libeay32.dll and ssleay32.dll into your windows\system32 folder

3) 转到\bin\php 并将libeay32.dll 和ssleay32.dll 复制到windows\system32 文件夹中

4) If you try and restart wampserver's services, you'll notice that lib_curl still doesn't work. Turns out that the version of php_curl.dll bundled in the pack is not compiled correctly.

4) 如果您尝试重新启动 wampserver 的服务,您会注意到 lib_curl 仍然不起作用。结果是打包中的 php_curl.dll 版本没有正确编译。

Apache's error log contained the following:

Apache 的错误日志包含以下内容:

Warning: PHP Startup: Unable to load dynamic library

警告:PHP 启动:无法加载动态库

'c:/wamp/bin/php/php5.3.13/ext/php_curl.dll' - The application has failed to start because its side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail.

'c:/wamp/bin/php/php5.3.13/ext/php_curl.dll' - 应用程序无法启动,因为它的并排配置不正确。请查看应用程序事件日志或使用命令行 sxstrace.exe 工具获取更多详细信息。

5) You'll need a properly compiled version of php_curl.dll. I downloaded php_curl-5.3.13-VC9-x64.zip from this blog post:

5) 您需要一个正确编译的 php_curl.dll 版本。我从这篇博文下载了 php_curl-5.3.13-VC9-x64.zip:

[www.anindya.com]

[www.anindya.com]

Direct link:

直接链接:

[www.mediafire.com]

[www.mediafire.com]

I replaced php_curl.dll inside \bin\php\php5.3.13\ext with the one above, and everything worked fine smiling smiley 6) To test if the cURL extension is working for you, try this code snippet

我用上面的替换了 \bin\php\php5.3.13\ext 中的 php_curl.dll,一切都运行良好,微笑着笑脸 6) 要测试 cURL 扩展是否适合你,试试这个代码片段

`

`

<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
'http://news.google.com/news?hl=en&topic=t&output=rss');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contents = curl_exec ($ch);
echo $contents;
curl_close ($ch);
?>

`

`

Here's another post with similar info (I found this after I wrote these instructions): [www.o3n.org]

这是另一篇包含类似信息的帖子(我在写完这些说明后发现了这个):[www.o3n.org]

回答by Abhishek Rakshit

Had same issue with 64 bit Windows 7. This is what worked for me.

在 64 位 Windows 7 上有同样的问题。这对我有用。

Answered by Soren from another SO thread - CURL for WAMP

Soren 从另一个 SO 线程回答 - WAMP 的 CURL

"There seems to be a bug somewhere. If you are experiencing this on Win 7 64 bit then try installing apache addon version 2.2.9 and php addon version 5.3.1 and switching to those in WAMP and then activating the CURL extension. That worked for me."

“某处似乎存在错误。如果您在 Win 7 64 位上遇到此问题,请尝试安装 apache 插件版本 2.2.9 和 php 插件版本 5.3.1 并切换到 WAMP 中的那些,然后激活 CURL 扩展。那行得通为了我。”

回答by shyammakwana.me

if you have already uncommented line from php.ini and still getting error than you should make sure that this extension file is exists in php folder or not

如果您已经取消了 php.ini 中的注释行并且仍然出现错误,那么您应该确保该扩展文件是否存在于 php 文件夹中

so check for this file

所以检查这个文件

php_curl.dll

php_curl.dll

in

{wamp}\bin\php\php5.x.x\ext\

{wamp}\bin\php\php5.xx\ext\

if it's not there than download it from internet and paste it to there

如果它不存在,则从互联网上下载并粘贴到那里

Restart Apache.

重新启动阿帕奇。

回答by krishna

  • download curl for windows (http://curl.haxx.se/download.html)
  • Paste the zip file content into C:\wamp\bin\apache\apache2.2.x
  • Locate and open your php.ini file (resides in C:\wamp\bin\php\php5.x)
  • In your php.ini file, change/ uncomment the following line: ;extension=php_curl.dll(you do so by removing the semi-colon)
  • restart Apache or the whole server to enjoy
  • 下载适用于 Windows 的 curl ( http://curl.haxx.se/download.html)
  • 将 zip 文件内容粘贴到 C:\wamp\bin\apache\apache2.2.x
  • 找到并打开您的 php.ini 文件(位于 C:\wamp\bin\php\php5.x)
  • 在 php.ini 文件中,更改/取消注释以下行:( ;extension=php_curl.dll通过删除分号来实现)
  • 重启 Apache 或整个服务器即可享受

回答by Gainster

this sloved my problem

这解决了我的问题

  1. Stop WAMP completely.
  2. Find your WAMP folder C:\Path\To\WAMP\bin\Apache\ApacheVersion\bin\
  3. Edit that php.ini and uncomment extension=php_curl.dll
  4. Restart WAMP.
  1. 完全停止 WAMP。
  2. 找到您的 WAMP 文件夹 C:\Path\To\WAMP\bin\Apache\ApacheVersion\bin\
  3. 编辑那个 php.ini 并取消注释 extension=php_curl.dll
  4. 重新启动 WAMP。

That should hopefully solve it.

这应该有望解决它。