Hello all.
Okay, this seems really stupid, but it's driving me up the wall.
I have a simple script I've written to log some information to a text
file. Everything seems to be okay, the code isn't throwing any errors,
but for some reason it isn't writing to file. If anyone has any ideas,
please let me know.
Here's the code I'm using:
//trigger_error("Just Testing to see if this is working",E_USER_NOTICE);
$strTimeStamp=date("F j, Y h:i:s A");
$strLogEntry=$strTimeStamp . ", " . $REQUEST_URI . ", " . $_SERVER
['HTTP_REFERER']. "\r\n";
//echo $strLogEntry;
$logfile='../logs/fce.log';
$logExists=file_exists($logfile);
if($logExists){
echo "File Exists<br>";
}
else{
echo "File Does Not Exist<br>";
}
$writable=is_writable($logfile);
if($writable){
echo "File Can Be Written to<br>";
}
else{
echo "File Cannot Be Written to<br>";
}
$fileHandle=fopen($logfile, "a");
if($fileHandle){
echo "File Opened for writing.<br>";
$written=fwrite($fileHandle, $strLogEntry);
echo "File written to successfully.<br>";
$closed=fclose($fileHandle);
echo "File closed succesfully.<br>";
}
else{
error_log("$logfile does not exist");
}
--
Randy Jackson
http://fourcolorexplosion.com