1

我正在尝试使用 file_get_contents () 读取一个文件——它是一个远程 HTTP 文件,我已经检查了 URL,它很好。只是它不起作用。

更重要的是,错误消息是标准的 Firefox 服务器错误:

连接被重置

加载页面时重置与服务器的连接。

...而不是任何形式的 PHP 错误。它也只花了几秒钟就回来了,所以它不会达到脚本运行时限制 - 关于这里出了什么问题的任何想法?

它是 Apache 2 上的 PHP 5,在 Windows 上运行。

为了澄清这是我与我的 .php 文件的连接有这个问题。即使远程文件不存在,我至少预计会出现错误 - 我的网络服务器显然正在断开连接,而不是至少给出错误消息是问题所在。

更新 2:与 fopen 而不是 file_get_contents 相同的问题

更新 3:它甚至可能使服务器崩溃:

[Sun Mar 28 17:46:21 2010] [notice] Server built: Dec 10 2008 00:10:06
[Sun Mar 28 17:46:21 2010] [notice] Parent: Created child process 2720
[Sun Mar 28 17:46:21 2010] [notice] Child 2720: Child process is running
[Sun Mar 28 17:46:21 2010] [notice] Child 2720: Acquired the start mutex.
[Sun Mar 28 17:46:21 2010] [notice] Child 2720: Starting 64 worker threads.
[Sun Mar 28 17:46:21 2010] [notice] Child 2720: Starting thread to listen on port 80.
[Sun Mar 28 17:46:24 2010] [notice] Parent: child process exited with status 255 -- Restarting.
[Sun Mar 28 17:46:24 2010] [notice] Apache/2.2.11 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Sun Mar 28 17:46:24 2010] [notice] Server built: Dec 10 2008 00:10:06
[Sun Mar 28 17:46:24 2010] [notice] Parent: Created child process 4912
[Sun Mar 28 17:46:24 2010] [notice] Child 4912: Child process is running
[Sun Mar 28 17:46:24 2010] [notice] Child 4912: Acquired the start mutex.
[Sun Mar 28 17:46:24 2010] [notice] Child 4912: Starting 64 worker threads.
[Sun Mar 28 17:46:24 2010] [notice] Child 4912: Starting thread to listen on port 80.
[Sun Mar 28 17:46:31 2010] [notice] Parent: child process exited with status 255 -- Restarting.
[Sun Mar 28 17:46:31 2010] [notice] Apache/2.2.11 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Sun Mar 28 17:46:31 2010] [notice] Server built: Dec 10 2008 00:10:06
[Sun Mar 28 17:46:31 2010] [notice] Parent: Created child process 2560
[Sun Mar 28 17:46:31 2010] [notice] Child 2560: Child process is running
[Sun Mar 28 17:46:31 2010] [notice] Child 2560: Acquired the start mutex.
[Sun Mar 28 17:46:31 2010] [notice] Child 2560: Starting 64 worker threads.
[Sun Mar 28 17:46:31 2010] [notice] Child 2560: Starting thread to listen on port 80.
[Sun Mar 28 17:46:34 2010] [notice] Parent: child process exited with status 255 -- Restarting.
[Sun Mar 28 17:46:34 2010] [notice] Apache/2.2.11 (Win32) PHP/5.3.0 configured -- resuming normal operations
[Sun Mar 28 17:46:34 2010] [notice] Server built: Dec 10 2008 00:10:06
[Sun Mar 28 17:46:34 2010] [notice] Parent: Created child process 712
[Sun Mar 28 17:46:34 2010] [notice] Child 712: Child process is running
[Sun Mar 28 17:46:34 2010] [notice] Child 712: Acquired the start mutex.
[Sun Mar 28 17:46:34 2010] [notice] Child 712: Starting 64 worker threads.
[Sun Mar 28 17:46:34 2010] [notice] Child 712: Starting thread to listen on port 80.
[Sun Mar 28 17:49:19 2010] [notice] Parent: child process exited with status 255 -- Restarting.
[Sun Mar 28 17:49:19 2010] [notice] Apache/2.2.11 (Win32) PHP/5.3.0 configured -- resuming normal operations
4

1 回答 1

0

使用cUrl并通过代理建立连接:CURLOPT_HTTPPROXYTUNNEL

于 2010-03-28T17:07:47.650 回答