Jump to content

Problem with PHP and Apache


kara_c

Recommended Posts

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!  :D

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.