kara_c Posted January 27, 2010 Share Posted January 27, 2010 Hello, I am have problem with PHP and Apache server. I have script which can include output from other script loaded by file_get_contents(). When I am calling cross-server communication, I do file_get_contents('http://www.remote.tld/file.php'); When my script connects to another server everything works fine. However I cannot do this on my own server, even to any file. I cannot load any URL from my own server with file_get_contents(). When I do this I get an infinite server timeout. Which makes me think the problem are with Apache only processing one request at once. Example: $var=file_get_contents('http://remote.tld/playerstats.php'); #Loads normally from other person server $var=file_get_contents('http://mydomain.tld/playerstats.php'); #times out forever $var=file_get_contents('http://mydomain.tld/test.txt'); #times out forever $var=file_get_contents('http://myotherdomain.tld/playerstats.php'); #times out forever $var=file_get_contents('http://myotherdomain.tld/test.txt'); #times out forever I need to use file_get_contents because I am switch() through both local and remote domains. Using Apache 2.0.63 and PHP 5.1.6 Thank you! Link to comment https://forums.phpfreaks.com/topic/189934-problem-with-php-and-apache/ Share on other sites More sharing options...
oni-kun Posted January 29, 2010 Share Posted January 29, 2010 Why not do this? $foo = file_get_contents($_SERVER['HTTP_HOST'] . "/foostats.php"; This may resolve your problem, as you're not posting any other code this is all I can assume that is happening. If it persists, try using $_SERVER['DOCUMENT_ROOT'] and if that fails, then use fopen/fget. I don't see how it can make an infinite loop! Link to comment https://forums.phpfreaks.com/topic/189934-problem-with-php-and-apache/#findComment-1003576 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.