Display PHP Errors in IIS

IF you set custom error to Detailed in feature settings of error pages for website and server both

AND if in your php.ini file you set the display_errors = on & error_reporting = E_ALL

THEN there is only one possibility for getting [IIS default 500 error page] is that "Your PHP is not working coz of miss configuration."

The required configurations are:

After setting Handler Mappings to your php-cgi.exe file(which is in you php installation dir) as FastCGI, open the php.ini file and edit following lines OR add if not found in file. (if php.ini is not exists in you PHP installation dir then rename from existing php.ini-development OR php.ini-production)

1) extension_dir = "ext\"

;ext folder will be in PHP installation, if not create and don't forget ending \

2) log_errors = On

3) error_log = "C:\inetpub\temp\php-errors.log"

4) cgi.force_redirect = 0

; may be you need to add this line add it anywhere, for instance-before '; File Uploads ;'

5) cgi.fix_pathinfo = 1

6) fastcgi.impersonate = 1

7) fastcgi.logging = 0

 Be careful and there should not `;` before any of these lines.

see documentation - installing/configuring PHP

Even after correct configurations PHP may not work because of system corruption. You can check by double click on php-cgi.exe and php-win.exe it should run without proper error (other then warnings OR ext/fileName... is missing messages - these are OK).

Note: after these many other setting are requires to run all things of php (ex. session), but by these SIMPLE PHP WILL WORK or PHP will properly show the error for what's wrong (NOT 500 page).

Tags:

Php

Iis