blank white page / 500 internal server error
Author: admin admin Reference Number: AA-00207 Views: 56035 Created: 2011-08-08 17:06 Last Updated: 2025-08-12 21:42 0 Rating/ Voters

If when visiting your site or a specific web page that uses php and you see a white page, or a '500 internal server error' message this is normally caused by a php coding error. 

To get more information on what the cause is, and how to fix it php 'display errors' should be enabled.

Below is 2 methods to enable 'display errors' 

The quickest way to display all php errors and warnings is to add these lines to your PHP code file:

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

What Do These Lines of Code Do Exactly?

The ini_set function will try to override the configuration found in your PHP ini file.

The display_errors and display_startup_errors are just two of the available directives. The display_errors directive will determine if the errors will be displayed or hidden from the user. Usually, the dispay_errors directive should be turned off after development.

The display_startup_errors, however, is a separate directive because the display_errors don’t handle the errors that will be encountered during PHP’s startup sequence. The list of directives that can be overridden by the ini_set function is found in the official documentation.

Unfortunately, these two directives won’t be able to display parse errors such as missing semicolons or missing curly braces. In this case, the .htaccess file must be edited.

Display PHP errors via .htaccess configuration

Developers usually have access to the directory files. The directive for showing PHP errors can also be enabled or disabled using the .htaccess file located in the root or public directory of the project.

php_flag display_startup_errors on
php_flag display_errors on

Similar to what will be added to the PHP code to show PHP errors, .htaccess also has directives for display_startup_errors and display_errors. The advantage of showing or disabling error messages in this manner is that development and production can have different .htaccess files, where the production suppresses the displaying of errors.
Depending on which files you have access to and how you do deployments and server configurations, you may want to configure display_errors in .htaccess or your PHP.ini file. Many hosting providers will not allow you to modify your PHP.ini file to enable display_errors.
In the .htaccess file, a custom error log can also be enabled as long as the log folder or the log file is writable by the web server. The log file can be a relative path to where the .htaccess is located, or it can be an absolute path such as /var/www/html/website/public/logs.

php_value error_log logs/all_errors.log


Quick Jump Menu