Web Hosting Talk







View Full Version : Strange PHP problem


highlander
07-05-2001, 08:32 PM
We are having some PHP problems on our RaQ4r.

We have used this code on several other servers but for some reason the RaQ processes it very slowly -

if we change this

<? // readfile menu.txt
$fp = "http://" . $SERVER_NAME . "/res/menu.txt";
$menu = readfile($fp);
?>

to this

<? // readfile menu.txt
$fp = $DOCUMENT_ROOT . "/res/menu.txt";
$menu = readfile($fp);
?>

it all runs quickly, any idea what the problem could be?

Robert

qslack
07-05-2001, 09:16 PM
Well, the first one requests the file from the local web server, and the second opens the file itself. Requesting it from the local webserver is going to have quite a bit of overhead, because it must send the request and headers, and then the server must parse the headers, read the file, send headers, and the file.

Just use the second piece of code.