Problem Writing To File
From: Randy Jackson (randyjackson_at_nounsolicitedfourcolorexplosion.com)
Date: 10/29/04
- Next message: Janwillem Borleffs: "Re: PHP/Soap not possible to return a complex type or array??"
- Previous message: Alvaro G. Vicario: "Re: How to populate <input type=file...> with default value?"
- Next in thread: Pedro Graca: "Re: Problem Writing To File"
- Reply: Pedro Graca: "Re: Problem Writing To File"
- Reply: Steven Stern: "Re: Problem Writing To File"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 29 Oct 2004 16:53:58 -0500
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
- Next message: Janwillem Borleffs: "Re: PHP/Soap not possible to return a complex type or array??"
- Previous message: Alvaro G. Vicario: "Re: How to populate <input type=file...> with default value?"
- Next in thread: Pedro Graca: "Re: Problem Writing To File"
- Reply: Pedro Graca: "Re: Problem Writing To File"
- Reply: Steven Stern: "Re: Problem Writing To File"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|