simple question (actually 2) syslog and fopen failures

Problems with the Windows version of XAMPP, questions, comments, and anything related.

simple question (actually 2) syslog and fopen failures

Postby mnemotronic » 16. October 2006 07:03

My brain isn't working now - I can't seem to find anything like this.

I have XAMPP installed under XP. I have a .php web page that I would like to convince to log debug info. The following can't open the debug log file, and the system event log entry created when fopen fails is useless. The .php file is in "C:\Program Files\xampp\htdocs", and the "UserLogs" dir is a subdir of that. NT file permissions for the "UserLogs" dir -- "EVERYONE" has Modify / Read&Execute / list folder contents / Read / Write permissions. I've tried fopening the log file in different dirs, I've tried forward and backslashes in the filename, and it fails every time. I'm guessing this is some kind of php / apache / NT permissions thing - sysinternals FileMon was no help...

Other notes: Xampp pages, mySql admin user root acct, and phpMyAdmin ARE "secure", ftp & merc-mail are NOT running, and php is NOT in safe mode (i.e. it is "UNSECURE" according to the security check page).

Code: Select all
$g_DebugLogFname = 'UserLogs\SvcMon.debug.log' ;
   
define_syslog_variables();
openlog($_SERVER['SCRIPT_NAME'],LOG_NDELAY,LOG_USER) ;
function dbglog($txt)
{
  if ($dbglogfs = fopen($g_DebugLogFname,'a'))
  {
    if (is_array($txt))
    {
      foreach ($txt as $line)
      {
          fprintf ($dbglogfs,"%s %s : %s : \n",date("Y-M-d H:i:s"),$_SERVER["REMOTE_ADDR"],$line);
      }
    }
    else { fprintf ($dbglogfs,"%s : %s : \n",date("Y-M-d H:i:s"),$_SERVER["REMOTE_ADDR"],$txt); }
    fclose($dbglogfs) ;
  }
  else
  {
    syslog (LOG_ERR,"Can't open $g_DebugLogFname $php_errormsg");
  }
}


Here's the useless event log entry:
Code: Select all
The description for Event ID ( 3 ) in Source ( PHP-5.1.6 ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: /SvcMon.php, Can't open  .
mnemotronic
 
Posts: 11
Joined: 16. October 2006 06:07
Location: Boulder

Postby Wiedmann » 16. October 2006 13:31

Wiedmann
AF Moderator
 
Posts: 17106
Joined: 01. February 2004 12:38
Location: Stuttgart / Germany

Postby mnemotronic » 16. October 2006 19:12

Wiedmann wrote:You should read:

Variable scope
http://de.php.net/manual/en/language.va ... .scope.php


ARGH!! Yes, php's scoping had me. Been in Perl-land ... Thanks for the pointer. Now I just have to back out all the httpd.conf and php5.ini whang-doodles I've stuck in.
mnemotronic
 
Posts: 11
Joined: 16. October 2006 06:07
Location: Boulder


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 53 guests