Welcome! Log In Create A New Profile

Advanced

Getting "upstream timed out" error on php files only

Posted by Kathryn 
Getting "upstream timed out" error on php files only
March 11, 2013 04:25PM
I'm using NGINX with PHP and FastCGI

I'm getting the "upstream timed out (110: Connection timed out) while reading response header from upstream," error only when fopen(), stream_get_contents(), or file_get_contents() are used, but only with .php files, if I rename the file to .html then it works.

EXAMPLE: I have three files fopen.php, test.php, test. html; where test.php and test.thml return the exact same thing "hello world", but if I try to access .php from the fopen.php file I get the error:

MY FILES:


fopen.php

<?php
$url = "http://localhost/test/test.php"; //doesn't work
//$url = "http://localhost/test/test.html"; //works
echo "url [$url]<br>";

$h = fopen($url, "rb") or die ("can't open the file");
$data = stream_get_contents($h);
fclose($h);

echo "<pre>";
echo "data [$data]";
echo "</pre>";
?>



test.php

<?php
echo "hello world";
?>



test.html

hello world
Attachments:
open | download - fopen.php (355 bytes)
open | download - test.php (36 bytes)
open | download - test.html (13 bytes)
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 329
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready