Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Error Logs on IIS 7.5/Windows Server 2008

I'm confused about where I should be looking for a log file containing php errors on a Windows 2008 Server running IIS 7.5 (I'm more familiar with the Mac OS X setup for this).

In my php.ini file I have log_errors set to "On" but I'm not seeing any php errors in the IIS logs that appear in this folder:

C\inetpub\logs\LogFiles

Is it possible to have the php errors included in this file or do I need to specify a new file just for php errors?

(I'm trying to troubleshoot a site that is generating 500 – Internal server error for a php error. I've found this site http://www.webdigi.co.uk/blog/2009/php-on-windows-server-2008-500-internal-server-error-on-iis/ that explains how I can view the error when accessing the page via an RDP session on the server, but I need to be able to log these and view the log as I won't always have RDP access).

like image 276
user982124 Avatar asked Mar 24 '13 22:03

user982124


People also ask

How do I view PHP error logs?

Look for the entry Configuration File (php. Find the Error handling and logging section of the php. ini file. Make sure that both display_errors = On, display_startup_errors = On and log_errors = On are present and uncommented. Check the value of error_log - this tells you the location of the file errors are logged to.

How do I enable PHP error logging?

Enable Error Logging in php. If you want to enable PHP error logging in individual files, add this code at the top of the PHP file. ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); Now, you must enable only one statement to parse the log errors in the php.

Where is the default PHP error log?

If the syslog is used, then all PHP errors will be sent directly to the default system log file—in Linux, this is typically /var/log/syslog.


1 Answers

In the php.ini (you can find this under "c:\program files (x86)\php\{PHP Version}") change these settings:

log_errors = On

Then set error_log to syslog for the windows event log:

error_log = syslog

Or specify a location on disk such as:

error_log = C:\Windows\temp\php_errors.log

Make sure that the error_log or log_error values aren't being set elsewhere in the file.

like image 156
Zymotik Avatar answered Oct 05 '22 12:10

Zymotik