无法在Windows Apache上使用PHP加载cURL

Sha*_*awn 1 php windows apache curl

我对设置Apache/PHP Web服务器并不熟悉,但我必须这样做,因为我的IT人员不会这样做.我已经查看了我在网上可以找到的所有内容,而且我无法在Windows apache上使用cURL加载PHP.我安装了Apache 2.2,它的工作原理.我安装了PHP,以及作品,这我知道,因为我的PHP脚本进行检查,以确保卷曲扩展加载,我的PHP回声返回给浏览器,我的代码如下所示:

  if (!extension_loaded("curl")) {
     header('Status: 500', true, 500);
     echo 'cURL extension for PHP is not loaded! <br/> Add the following lines to your php.ini file: <br/> extension_dir = &quot;&lt;your-php-install-location&gt;/ext&quot; <br/> extension = php_curl.dll';
     return;
  }
Run Code Online (Sandbox Code Playgroud)

我做了以下事情:

  • 我已经取消注释extension_dir="c:\php\ext\"(并尝试了该路径的多种变体,使用向前和向后斜线等,以及./ext/方法).
  • 我确保我有extension=php_curl.dll我的php.ini.
  • 我已经确保我的apache用户对PHP文件夹和所有子文件夹/文件具有读取和执行权限
  • 我已经确定C:\PHP我的路径环境变量.
  • 我在这里尝试了这些建议:无法加载php_curl,这里:修改php.ini以及StackOverflow之外的许多其他人都没有加载PHP cURL.

没有任何效果.我在Windows Server 2003上运行.我在Apache日志中没有收到任何错误消息.我被卡住了.请帮忙!谢谢.

添加请求的Apache日志信息:

[Tue Aug 14 14:38:22 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Aug 14 14:38:23 2012] [notice] Apache/2.2.22 (Win32) PHP/5.2.17 mod_ssl/2.2.22 OpenSSL/0.9.8t configured -- resuming normal operations
[Tue Aug 14 14:38:23 2012] [notice] Server built: Jan 28 2012 11:16:39
[Tue Aug 14 14:38:23 2012] [notice] Parent: Created child process 5616
[Tue Aug 14 14:38:24 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Aug 14 14:38:25 2012] [notice] Child 5616: Child process is running
[Tue Aug 14 14:38:25 2012] [notice] Child 5616: Acquired the start mutex.
[Tue Aug 14 14:38:25 2012] [notice] Child 5616: Starting 64 worker threads.
[Tue Aug 14 14:38:25 2012] [notice] Child 5616: Starting thread to listen on port 8080.
Run Code Online (Sandbox Code Playgroud)

小智 5

如果你在Windows操作系统中安装PHP,Apache,那么下面的步骤可以帮助你php_curl.dll顺利运行.

  1. 找到php.ini(可能在C:\Windows)文件的位置并打开它.然后取消注释(从中删除分号(;);extension=php_curl.dll)并保存文件.
  2. 确保php_curl.dllPHP扩展目录(C:\php\ext)中存在该文件.此扩展路径在php.ini文件中定义.
  3. 副本php4ts.dll(如果您使用PHP4)或者php5ts.dll(如果你使用PHP5),libeay32.dllssleay32.dllC:\WINNT(Windows 2000)或C:\Windows(Windows 2003中)的目录.如果php4ts.dll还是php5ts.dll没有在你的电脑中发现,然后在谷歌和下载搜索.其他两个DLL可以在PHP目录的dll目录中找到(可能在C:\php\ext)
  4. 重启Apache服务.

再次检查cURL是否已启用.如果没有,请重新启动计算机.
现在再次运行脚本,看看你的php_curl现在正在顺利运行.
如果没有,请将3 dll文件(在第3号中描述)复制到PHP根目录(可能是C:\php)以及Windows system32目录(C:\Windows\system32)中.

现在顺利运行你的php cURL脚本.祝你今天愉快.