To enhance the security of your web site and our servers, PHP has been modified to disable the display of error messages in web browsers. To view any warnings and debugging messages from PHP, you will need to use the guidelines mentioned in this document.

For PHP, we have globally set the PHP option for displaying errors as follows:

display_errors = Off

If you are developing PHP scripts and see a blank page in your browser, we recommended you insert the following code into the top of your page for debugging purposes:

<?
 ini_set('display_errors','on');

 // rest of php script here....
?>

When you have completed the development and debugging of your script, we highly advise that you remove the following line from your code:

 ini_set('display_errors','on');

By removing the above-mentioned line, errors will no longer display potentially sensitive information about your hosting account to a web browser. Such information could allow computer hackers to gather information about the structure of your web site and the script itself. They could then try to exploit that information in order to gain unauthorized access to your web site.

Syntax Errors (Parsing Errors)

Note: with display_errors set to off, some people may not be able to view all warnings and errors in their PHP scripts. This can occur even if they have included the code examples that we have provided above. This is because PHP tries to completely parse a script before it begins any execution of the PHP code. If there are parsing errors (a.k.a. syntax errors) in the script, the command that we describe above will never be executed and PHP will still return a blank page with no errors. This happens, of course, because we have globally turned off the displaying of errors.

To fix error message-related issues, you can upload the following plain text file with the name .htaccess (no prefix before the dot) into the directory that contains the PHP script you are trying to debug. Be careful not to overwrite any existing .htaccess files! If one exists, download it first and add this text to it. Remember if using FTP to download the file in ASCII mode.

The .htaccess File

php_flag display_errors on

Once this file is uploaded you should be able to see errors in your browser similar to:

Parse error: parse error, unexpected T_STRING in /home/user/www/example.com/error.php on line 12

Remember to delete this file when done (or remove the line if you added it to an existing file). Uploading the .htaccess file to the root of your web site will enable this option for all PHP pages on your site.

Please note: the information on this page applies to ITS web hosting plans. It may or may not apply to other environments. If you are looking for a feature described here, or better support from your hosting provider, please consider hosting your site with ITS!

1555 N Naperville/Wheaton Road, Suite 107
Naperville, IL 60563
phone 630.420.2550
fax 630.420.2771