{"id":1269,"date":"2020-07-16T13:48:11","date_gmt":"2020-07-16T13:48:11","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2020\/07\/16\/4259219-how-to-display-php-error-messages-in-hostinger\/"},"modified":"2026-03-16T12:12:14","modified_gmt":"2026-03-16T12:12:14","slug":"4259219-how-to-display-php-error-messages-in-hostinger","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/4259219-how-to-display-php-error-messages-in-hostinger\/","title":{"rendered":"How to Display PHP Error Messages in Hostinger"},"content":{"rendered":"<p class=\"no-margin\">If your website uses PHP and it&rsquo;s not working as expected, displaying PHP error messages can help you efficiently identify and fix any potential issues within the code.<\/p><div class=\"intercom-interblocks-callout\" style=\"background-color: #e3e7fa80;border-color: #334bfa33\">\n<p class=\"no-margin\">The PHP programming language is <b>not used<\/b> in<b> Hostinger Website Builder<\/b>. Therefore, it is not possible to display PHP errors on such websites &#128161;<\/p>\n<\/div><p class=\"no-margin\">There are a few alternative methods you can choose from to display and log error messages. Check the detailed steps below:<\/p><div class=\"intercom-interblocks-callout\" style=\"background-color: #e3e7fa80;border-color: #334bfa33\">\n<p class=\"no-margin\">These options apply to PHP functions like <b>Warning, Deprecate, Notice<\/b>, etc. Non-PHP errors, such as 503 errors, database connection issues, etc., will not be logged.<\/p>\n<\/div><h2 id=\"how-to-enable-errors-display-and-logging-in-hpanel\">Option 1 &ndash; Error Display and Logging<\/h2><p class=\"no-margin\">You have two settings available on hPanel regarding information about PHP errors:<\/p><ul>\n<li>\n<p class=\"no-margin\">To <b>display them on the website<\/b> directly<\/p>\n<\/li>\n<li>\n<p class=\"no-margin\">To <b>store them in a log file<\/b><\/p>\n<\/li>\n<\/ul><p class=\"no-margin\">To enable either or both of them, go to <b><a class=\"intercom-content-link\" href=\"https:\/\/hpanel.hostinger.com\/websites\" target=\"_blank\" rel=\"noopener\">Websites<\/a> <\/b>&rarr;<b> Dashboard<\/b>, search for <b>PHP Configuration<\/b> on the sidebar and click on it:<\/p><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"\/support\/wp-content\/uploads\/sites\/55\/2020\/07\/5ac4ba1d-1b8d-4b98-ad0c-dd5e0503c5a6.jpg\" alt=\"The PHP Configuration menu option\"><\/div><p class=\"no-margin\">Once there, head to the PHP options tab and check the corresponding boxes:<\/p><ul>\n<li>\n<p class=\"no-margin\">To make errors visible on your website directly, enable the <b>displayErrors <\/b>(display_errors) parameter<\/p>\n<\/li>\n<li>\n<p class=\"no-margin\">To log a record of the errors to a file, mark the <b>logErrors <\/b>(log_errors) checkbox:<\/p>\n<\/li>\n<\/ul><div class=\"intercom-container intercom-align-center\"><img decoding=\"async\" src=\"\/support\/wp-content\/uploads\/sites\/55\/2020\/07\/c771f8df-fb86-49f7-a069-cac5505f5aeb.jpg\" alt=\"The PHP options tab showing how to enable display and log errors\"><\/div><p class=\"no-margin\">Scroll down to the bottom of the page and click on <b>Save <\/b>to apply the changes.<\/p><h2 id=\"how-to-enable-errors-display-in-wordpress-\">Option 2 &ndash; Display Errors on WordPress<\/h2><p class=\"no-margin\">If you are using WordPress, go to the <b><a class=\"intercom-content-link\" href=\"\/support\/4548688-basic-actions-in-file-manager\" target=\"_blank\" rel=\"noopener\">File Manager<\/a><\/b> and open your public_html\/<b>wp-config.php<\/b> file. Then, search for the <b>debugging<\/b> line:<\/p><pre><code>define('WP_DEBUG', false);<\/code><\/pre><p class=\"no-margin\">If the line exists, change the value from <b>false<\/b> to <b>true<\/b>. Then, add the following line to enable error display on your website:<\/p><pre><code>define('WP_DEBUG_DISPLAY', true);<\/code><\/pre><p class=\"no-margin\">That&rsquo;s it &ndash; now the PHP errors, if any, will be displayed directly on your WordPress website.<\/p><h2 id=\"h_187e953dcb\">Option 3 &ndash; Display and Log Errors via the .htaccess File<\/h2><p class=\"no-margin\">You can log the PHP errors to a log file of your choice using the .htaccess file. First, create a <b>backup of the .htaccess file<\/b> before making any changes, as incorrect settings can make your website inaccessible. Or, if there is no .htaccess file, you can <b><a class=\"intercom-content-link\" href=\"\/support\/1583307-how-to-create-an-htaccess-file\" target=\"_blank\" rel=\"noopener\">create it<\/a><\/b>.<\/p><p class=\"no-margin\">Next, add the following lines to your website&rsquo;s <b>.htaccess<\/b> file:<\/p><pre><code># log PHP errors to a file\r\nphp_flag log_errors on\r\nphp_value error_reporting 32767\r\nphp_value error_log \"error_log.txt\"<\/code><\/pre><p class=\"no-margin\">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 <b><a class=\"intercom-content-link\" href=\"\/support\/5375833-fiverr-services-at-hostinger\" target=\"_blank\" rel=\"noopener\">developer<\/a><\/b>.<\/p><p class=\"no-margin\"><b>NOTE<\/b><\/p><ul>\n<li>\n<p class=\"no-margin\">Once you are done working with the error data, it is recommended to <b><a class=\"intercom-content-link\" href=\"\/support\/1583189-how-to-hide-errors-and-warnings-on-your-website\" target=\"_blank\" rel=\"noopener\">hide it again<\/a><\/b> to prevent potentially sensitive information from being exposed to users and protect against security risks<\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Enabling PHP error messages for website troubleshooting at Hostinger<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[231],"tags":[],"class_list":["post-1269","post","type-post","status-publish","format-standard","hentry","category-php-errors"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/4259219-how-to-display-php-error-messages-in-hostinger\/","default":1},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/support\/4259219-como-activar-los-mensajes-de-error-de-php-en-hpanel-en-hostinger\/","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/support\/4259219-comment-activer-les-messages-d-erreur-php-sur-hpanel-hostinger\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/support\/4259219-cara-mengaktifkan-notifikasi-php-error-di-hpanel-hostinger\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/br\/support\/4259219-como-ativar-as-mensagens-de-erro-php-no-hostinger-hpanel\/","default":0},{"locale":"uk-UA","link":"https:\/\/www.hostinger.com\/ua\/support\/4259219-----\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1269","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=1269"}],"version-history":[{"count":2,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1269\/revisions"}],"predecessor-version":[{"id":6906,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/1269\/revisions\/6906"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=1269"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=1269"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=1269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}