【发布时间】:2012-08-14 18:48:12
【问题描述】:
我完全不熟悉设置 Apache/PHP Web 服务器,但我必须这样做,因为我的 IT 人员不会。我已经查看了我可以在网上找到的所有内容,但我无法让 cURL 在 windows apache 上的 PHP 中加载。我安装了 Apache 2.2,它可以工作。我安装了 PHP,它可以工作,我知道这是因为我的 php 脚本会检查以确保加载 cURL 扩展,并将我的 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 = "<your-php-install-location>/ext" <br/> extension = php_curl.dll';
return;
}
我做了以下事情:
- 我已取消注释
extension_dir="c:\php\ext\"(并尝试了该路径的多种变体,使用正斜杠和反斜杠等,以及./ext/方法)。 - 我确保我的
extension=php_curl.dll中有php.ini。 - 我已确保我的 apache 用户对 PHP 文件夹和所有子文件夹/文件具有读取和执行权限
- 我已确保我的路径环境变量中有
C:\PHP。 - 我已经尝试过这里的建议:Could not load php_curl,这里:PHP cURL is not loaded on modifying php.ini,以及 StackOverflow 之外的许多其他建议。
没有任何效果。我在 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.
【问题讨论】:
-
通过打开 cmd 检查您的 php cli 输出,然后 cd 进入目录并在第一行输入“php.exe -v”,您应该会看到为什么它没有加载的错误。然后与我们分享结果,以便我们为您提供帮助。
-
我在运行 php.exe -v 的 cmd 窗口中没有收到任何内容
-
function_exists('curl_init')是否也返回 false?我想知道是不是extension_loaded()坏了。另外,请记住,Apache mod_php SAPI 使用的 php.ini 配置仅在 Apache 启动时加载(不是每个请求),因此您需要在修改 php.ini 后重新启动 Apache 服务。如果根据 php.ini 设置可卸载扩展程序,您通常会在启动时看到 Apache 错误日志中记录的错误以及有用的(ish)错误消息。 -
@DaveRandom 我不是 PHP 程序员;我只需要在我的 ESRI javascript 网站上使用 php 代理,所以 extension_loaded() 函数只是 php api 调用。如何测试 function_exists('curl_init') 是否返回 false?
-
发布你的 页面