All Collections
PHP Errors
How to Display PHP Error Messages
How to Display PHP Error Messages

Enabling PHP error messages for website troubleshooting at Hostinger

Updated over a week ago

If your website uses PHP and it's not working as expected, displaying PHP error messages can help you efficiently identify and fix any potential issues within the code.

The PHP programming language is not used in Hostinger Website Builder. Therefore, it is not possible to display PHP errors on such websites 💡

There are a few alternative methods you can choose from to display and log error messages. Check the detailed steps below:

These options apply to PHP functions like Warning, Deprecate, Notice, etc. Non-PHP errors, such as 503 errors, database connection issues, etc., will not be logged.

Option 1 – Error Display and Logging

You have two settings available on hPanel regarding information about PHP errors:

  • To display them on the website directly

  • To store them in a log file

To enable either or both of them, go to Websites Manage, search for PHP Configuration on the sidebar and click on it:

The PHP Configuration menu option

Once there, head to the PHP options tab and check the corresponding boxes:

  • To make errors visible on your website directly, enable the displayErrors (display_errors) parameter

  • To log a record of the errors to a file, mark the logErrors (log_errors) checkbox:

The PHP options tab showing how to enable display and log errors

Scroll down to the bottom of the page and click on Save to apply the changes.

Option 2 – Display Errors on WordPress

If you are using WordPress, go to the File Manager and open your public_html/wp-config.php file. Then, search for the debugging line:

define('WP_DEBUG', false);

If the line exists, change the value from false to true. Then, add the following line to enable error display on your website:

define('WP_DEBUG_DISPLAY', true);

That's it – now the PHP errors, if any, will be displayed directly on your WordPress website.

Option 3 – Display and Log Errors via the .htaccess File

You can log the PHP errors to a log file of your choice using the .htaccess file. First, create a backup of the .htaccess file before making any changes, as incorrect settings can make your website inaccessible. Or, if there is no .htaccess file, you can create it.

Next, add the following lines to your website's .htaccess file:

# log PHP errors to a file
php_flag log_errors on
php_value error_reporting 32767
php_value error_log "error_log.txt"

Displaying and logging errors with any of these methods will help you troubleshoot your PHP code. If you require further help to solve the causes behind any error, you can seek the assistance of a developer.


  • Once you are done working with the error data, it is recommended to hide it again to prevent potentially sensitive information from being exposed to users and protect against security risks

Did this answer your question?