3

Am trying to log with syslog() on windows (IIS 7.5) and I just can't make it appear in the Windows Events.

What I tried so far:

  • php.ini -> error_log = "syslog" (this advised on multiple sites)
  • giving to the IUSR_... user the right permissions to wrote to the Event logs (even administrator permissions)

Any clue or help is appreciated!

ssibal
  • 131
  • 1
  • 5

1 Answers1

1

With PHP 5.2, PHP allows you two methods of logging PHP events using the error_log directive in php.ini. A typical set up would be to configure PHP to log to a flat file, by setting the error_log value to the full path and file name to your php log file.

Simply open your php.ini file with your text editor and replace;

log_errors = Off

With;

log_errors = On

This will turn on PHP logging in PHP. Next step is to direct PHP to log events to your Windows Event Log by finding this;

;error_log = syslog

And replacing it with;

error_log = syslog

Although syslog is actually the *nix equivalent of the Windows Event Log we still need to specify it here as PHP does not differentiate between the two, however PHP will know to log to the Windows Event Log when being used on a Windows System. With that done save your php.ini file and recycle the IIS application pools using PHP, and you should now start seeing PHP events being logged to your Windows Application Log in Event Viewer.

Dr. X
  • 2,890
  • 2
  • 15
  • 37
  • Yes, I also found this site (http://www.iis-aid.com/articles/how_to_guides/logging_php_to_windows_event_log), but it's not working: \ It changes nothing. – ssibal Sep 12 '17 at 11:49
  • Also copying entire site contents without putting a reference next to it is not too elegant.. – ssibal Sep 13 '17 at 09:42