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 .