I have a script that I finally got to work flawlessly on my local machine. When I try to run it on my remote hosting server, I used get an error (something about exceeding 2 seconds). Now after tweaking, I just get a browser time out (progress?).
Can anyone tell me what variables might cause this? I compared the phpinfo page for both and I couldn't see anythin obvious. Except output_buffering said no value on the remote host but 0 on the localhost.
The local host is running PHP4.1.2 on Mac OS X with Apache/1.3.26.
The remote host is running PHP4.2.3 on i686, i386-redhat-linux-gnu with Apache/1.3.27
Below is the script. It allows me to include links in pages so each of the include files can be updated manually without refreshing the entire page (some of my scripts take a while to gather information and display a page). This is my workaround. I display a staic html page unless the user (or robot) requests an update.
<?
/*
function takes a filename without extension
and evaluates the .PHP version, saving it
to a parsed .HTM version
*/
function update($update) {
//put the file into a string for eval
$filestring = implode ('', file("$update.php"));
//parse a mixed PHP/HTML string (derived from user notes at PHP.net "eval")
ob_start();
eval("?>" . $filestring . "<?php ");
$output = ob_get_contents();
ob_end_clean();
$filename = "$update.htm";
$somecontent = "$output";
// The file will be overwritten. if file doesn't exist, create it.
if (!$handle = fopen($filename, 'w')) {
print "Cannot open file ($filename)";
exit;
}
// Write $somecontent to our opened file.
if (!fwrite($handle, $somecontent)) {
print "Cannot write to file ($filename)";
exit;
}
fclose($handle);
}
?>
<?
//include this code to call the function from a URL query "?refresh=something
if (isset($refresh)){update("$refresh");}
?>