php Windows 7 64位和Apache下的PHP和CURL

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

PHP and CURL under Windows 7 64 bits and Apache

phpcurlinstallation

提问by mrmuggles

I'm trying to use curl with PHP on my box without any success.

我试图在我的盒子上使用 curl 和 PHP,但没有成功。

My Config :

我的配置:



OS : win 7 64 bits,

操作系统:赢得 7 64 位,

PHP : 5.3.1,

PHP : 5.3.1,

Apache : 2.2.14

阿帕奇:2.2.14



I was able to use the mysql extension, so the configuration of my php.ini seems fine. But I get and error in Apache log with curl :

我能够使用 mysql 扩展,所以我的 php.ini 配置看起来很好。但是我在使用 curl 的 Apache 日志中得到并出错:

PHP Warning: PHP Startup: Unable to load dynamic library 'C:/php-5.3.1/ext/php_curl.dll' - The specified module could not be found.\r\n in Unknown on line 0

PHP 警告:PHP 启动:无法加载动态库 'C:/php-5.3.1/ext/php_curl.dll' - 找不到指定的模块。\r\n 在第 0 行的未知中

The file is right there, and it's loading php_mysql.dll without any problem.

该文件就在那里,它正在加载 php_mysql.dll 没有任何问题。

I tried everything : to put the dll file in apache\bin, windows\system32, put the path of the php EXT in the PATH environment variable. to put some lib (libeay.dll and sssomething.dll) in windows 32

我尝试了一切:将dll文件放在apache\bin、windows\system32中,将php EXT的路径放在PATH环境变量中。在 Windows 32 中放置一些 lib(libeay.dll 和 sssomething.dll)

Well, I think this might have something to do with my Windows being 64 bits or with the version of PHP.. maybe. I don't know anymore :(

好吧,我认为这可能与我的 Windows 是 64 位或 PHP 版本有关..也许。我不知道了:(

Any idea?

任何的想法?

UpdateI'm not using Wamp because I like to know what I do to my system, and ultimately choose the version that I want of apache, php and MySql.

更新我没有使用 Wamp,因为我想知道我对我的系统做了什么,并最终选择了我想要的 apache、php 和 MySql 版本。

My Solution

我的解决方案

I added the path of PHP in my PATH environement variable and it worked. I'll try to find out what was the DLL needed.

我在我的 PATH 环境变量中添加了 PHP 的路径并且它起作用了。我将尝试找出所需的 DLL。

Update : Well it looks like it was libeay32.dll and sslleay32.dll had to be in the PATH environment variable. I added to the bin subdirectory of Apache and it worked.

更新:看起来它是 libeay32.dll 并且 sslleay32.dll 必须在 PATH 环境变量中。我添加到 Apache 的 bin 子目录中,它起作用了。

采纳答案by Sergei

AFAIR, you need libeay32.dll and libssl32.dll files on PATH for Curl to work properly. And probably 64 bit for your x64 system.

AFAIR,您需要 PATH 上的 libeay32.dll 和 libssl32.dll 文件才能使 Curl 正常工作。您的 x64 系统可能是 64 位的。

回答by Erfan Safarpoor

What I did for this problem with PHP cURL in Windows 7 64-bit / Windows 8 64-bit:

我在 Windows 7 64 位/Windows 8 64 位中使用 PHP cURL 为这个问题做了什么:

  1. Stop WampServer.
  2. Open php.iniin C:\wamp\bin\php\(your PHP version)and remove the semicolon from ;extension=php_curl.dll.
  3. Start WAMP and test.
  1. 停止 WampServer。
  2. 打开php.iniinC:\wamp\bin\php\(your PHP version)并从 中删除分号;extension=php_curl.dll
  3. 启动 WAMP 并进行测试。

If it is still not working:

如果还是不行:

I downloaded php_curl-(your PHP version)-VC9-x64.zipfrom this link, and replaced the default php_curl.dllin C:\wamp\bin\php\php-virsion\extwith the new one.

我下载php_curl-(your PHP version)-VC9-x64.zip这个链接,并替换默认php_curl.dllC:\wamp\bin\php\php-virsion\ext新一个。

This solved my problem.

这解决了我的问题。

回答by Tim Smith

I tried all above steps and still having same problem. I did copied the libeay32.dll and sselay.dll in to C:\windows\system32 and restart but still does not work.

我尝试了上述所有步骤,但仍然遇到同样的问题。我确实将 libeay32.dll 和 selay.dll 复制到 C:\windows\system32 并重新启动但仍然不起作用。

Yet, when I copied libeay32.dll and sselay.dll to C:\windows, it WORKS!!!!

然而,当我将 libeay32.dll 和 selay.dll 复制到 C:\windows 时,它工作了!!!!

回答by Andre

To enable cURL using PHP7, insert the C:\phpto the PATH: enter image description here

要使用 PHP7 启用 cURL,请C:\php在 PATH 中插入: 在此处输入图片说明

After that, go to C:\phpopen the php.inifile and uncomment the line extension extension=php_curl.dllby deleting the semicolon at the beginning of the line: enter image description here

之后,C:\php打开php.ini文件并extension=php_curl.dll通过删除行开头的分号来取消对行扩展名的注释: 在此处输入图片说明

Your are ready to go: enter image description here

你准备好了: 在此处输入图片说明

回答by codygman

It's been a while since i've been on windows, but I think you have to also make sure that curl has a check mark next to it under "plugins". Also, just searched google and found this:

我已经有一段时间没有使用 Windows 了,但我认为您还必须确保 curl 旁边的“插件”下有一个复选标记。另外,刚刚搜索了谷歌并发现了这个:

Curl can indeed be enabled under WAMP running on a Windows Environment.

Curl 确实可以在 Windows 环境上运行的 WAMP 下启用。

The steps are as follows :

步骤如下:

1) Close WAMP (if running) 2) Navigate to WAMP\bin\php(your version of php)\ 3) edit php.ini 4) Search for curl, uncomment extension=php_curl.dll 5) Navigate to WAMP\bin\Apache(your version of apache)\bin\ 6) edit php.ini 7) Search for curl, uncomment extension=php_curl.dll 8) Save both 9) Restart WAMP Source: http://www.dibugs.com/curl-enabling-wamp

1) 关闭 WAMP (如果正在运行) 2) 导航到 WAMP\bin\php(您的 php 版本)\ 3) 编辑 php.ini 4) 搜索 curl,取消注释 extension=php_curl.dll 5) 导航到 WAMP\bin\ Apache(您的 apache 版本)\bin\ 6)编辑 php.ini 7)搜索 curl,取消注释 extension=php_curl.dll 8)保存两者 9)重新启动 WAMP 来源:http: //www.dibugs.com/curl-启用-wamp

It appears you have to enable it in apache, as well as the php.ini. Try just right clicking on the wamp icon next time, hovering to extensions, then clicking on the desired extensions.

看来您必须在 apache 以及 php.ini 中启用它。下次尝试右键单击 wamp 图标,将鼠标悬停在扩展程序上,然后单击所需的扩展程序。

回答by Steve

Man, it's doing my head in. I've done the same right off the bat (experience with php...), added the path of PHP and PHP/ext, but no-go. It just would not init.

伙计,这让我很头疼。我马上就做了同样的事情(使用 php 的经验...),添加了 PHP 和 PHP/ext 的路径,但不行。它只是不会初始化。

I've installed all 64-bit on a win7 x64 (so mysql/php/apache are all 64-bit versions) but I'm at a loss.

我已经在 win7 x64 上安装了所有 64 位(所以 mysql/php/apache 都是 64 位版本),但我不知所措。

World of advice; install the 32-bit versions if you can help it. 64 bit is still the 'mystic future', sadly, regardless of x64 processors being around for years.

咨询世界;如果可以,请安装 32 位版本。遗憾的是,64 位仍然是“神秘的未来”,尽管 x64 处理器已经存在多年。

回答by tejzpr

You could have used the Wampserver from http://www.wampserver.com/en/From the menu it provides you can easily enable curl it takes care of the rest.

您可以使用来自http://www.wampserver.com/en/的 Wampserver 从它提供的菜单中,您可以轻松启用 curl,它会处理其余的工作。

Since there are packages like XAMPP http://www.apachefriends.org/en/xampp-windows.html, and WAMP already available on the net you can use them to set up the WAMP stack instead of building it from the scratch. Thease packages offer easy menus for enabling and disabling php extensions.

由于有像 XAMPP http://www.apachefriends.org/en/xampp-windows.html这样的软件包,并且 WAMP 已经在网上可用,因此您可以使用它们来设置 WAMP 堆栈,而不是从头开始构建它。Thease 包提供了用于启用和禁用 php 扩展的简单菜单。

回答by Someone

Please copy the libeay32.dll and sselay.dll in to the C:\windows and C:\windows\system32 and restart on your webserver and see the correct php.ini file is loaded

请将 libeay32.dll 和 selay.dll 复制到 C:\windows 和 C:\windows\system32 并在您的网络服务器上重新启动并查看正确的 php.ini 文件已加载

回答by Nathan Osman

This may be a longshot, but which php.ini did you edit? Because with WAMP, the one Apache uses is in the bin directory of Apache.

这可能是一个远景,但是您编辑了哪个 php.ini?因为使用 WAMP,Apache 使用的一个是在 Apache 的 bin 目录中。

回答by Neo

For others having the same problem, if the selected solution does not work, you should know that 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是错误的文件,我遇到了同样的问题,我在其中找到了正确的php_curl.dll文件/wamp/bin/php/php[youversion/ext/ 并替换它并且它起作用了。见这篇文章:http: //forum.wampserver.com/read.php?2,85716