PHP on Windows Server 2008 : 500 - Internal Server Error on IIS

7. April 2010

If you work on a Windows server 2008 machine with IIS 7.0 and with PHP on it you can ran into a strange error.
If there is a bug in your php Script - The server stops running the script with this message : 

Server Error

500 - Internal server error.

There is a problem with the resource you are looking for, and it cannot be displayed. Internal Server Error - Windows Server 2008


Cause:

This error happens on the default configuration of windows server 2008. The server logs do not say a lot except for the fact that the php file is causing an error. This happens for the following reasons on the server:

  •   PHP Fatal error (Something that you did or didn’t do caused the server to run into a fatal error)
  •   PHP error_reporting is on and there are some errors (Anything from a NOTICE or WARNING can cause this)


 
How to resolve:

The best way to resolve the error is find out what is wrong with the PHP code.
But how do you do this if the server won’t show you what the error is?
One of the best ways to find what is wrong with your PHP script is to:

Change IIS 7.0 Settings
You can always change the configuration using the Configuration Editor of IIS 7.0.
You will find this under the Section > system.webServer/httpErrors. You have to change errorMode to Detailed from the usual DetailedLocalOnly and then click on Apply.

This is also a good security measure as it will not accidentally show your PHP errors to the users of your system.





Bookmark it!

.NET, IIS 7.0, PHP on IIS 7.0 , , , ,


Pingbacks and trackbacks (3)+

Comments are closed