Why are you writing a logging class? Why not use error_log and enable error logging? On Fri, Mar 21, 2008 at 1:11 PM, Al <news@xxxxxxxxxxxxx> wrote: > int file_put_contents ( string $filename, mixed $data [, int $flags [, > resource $context]] ) > > This function is identical to calling fopen(), fwrite() and fclose() > successively to write data to a > file. > > This native function does it for you > > Mark Weaver wrote: > > Hi all, > > > > I've been lurking and reading now for some time, but have decided to > > come out of the shadows cause I've got an issue that's gonna drive me > > crazy! > > > > I'm developing an application and within this application is a class > > that is very simple and only serves a singular purpose - to make log > > entries to help with debugging. Problem is, now I'm debugging the damned > > logging class that is supposed to be helping me debug the application as > > I'm putting it together! <sigh> I've looked and looked all over the > > place, but I don't seem to be able to find an answer to this problem. > > The only information that I have found so far deals with permissions and > > I don't think that's the problem. At first I was getting an access > > denied error but since setting dir perms and log file perms so that both > > apache and my user can right to both the directory and the file that one > > has gone away. > > > > Log Directory permissions: /mystuff/logs rwx-rwx-rwx > (777) > > Log file permissions : /mystuff/logs/run.log rwx-rwx-rwx > > (777) > > > > At any rate, the following is the information I'm getting in the apache > > error_log while working on this particular portion of the application: > > > > PHP Warning: fwrite(): supplied argument is not a valid stream resource > > in /mystuff/inc/Log.inc on line 22, > > PHP Warning: fclose(): supplied argument is not a valid stream resource > > in /mystuff/inc/Log.inc on line 23, > > > > The Log class: > > ----------------------------- > > class Log{ > > public $path, $entry, $logfile; > > > > public function Log(){} > > > > public function setLog($path,$file){ > > $this->path = $path; > > $this->logfile = $file; > > } > > > > public function writeLog($entry){ > > // open the file, in this case the log file > > $h = "$this->path/$this->logfile"; > > fopen($h, 'a+'); > > fwrite($h,$entry); > > fclose($h); > > } > > } > > > > Code snippet where attempting to write log entry from program: > > > -------------------------------------------------------------------------------------------- > > > > $pl_log = new Log; > > $pl_log->setLog($logpath,"run.log"); > > > > $usernanme = $_POST['username']; > > $password = $_POST['secret']; > > > > /** > > * (debugging) logging incoming values from form: > > */ > > $pl_log->writeLog("getDateTime(): Incoming values from Login > Form: > > blah...blah...blah\n"); > > > > Any help with this would be most appreciated. (be gentle... I'm a PERL > > program learning PHP OOP) > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >