Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Getting "upstream timed out" error on php files only

$
0
0
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

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>