How to enable and disable PHP error messages in cPanel

Last modified: Friday November 24th, 2023

In this article, you will learn how to enable and disable PHP error messages using the display_errors directive in the php.ini file.

The steps in this article can be completed if you have already set up a custom php.ini file on your website. If you haven’t set up your own php.ini file yet, read this article first.

Error messages and the display_errors directive

PHP displays error messages in the user’s web browser by default. And this is a very useful feature in the initial development and debugging of your website. But after the development of a website is completed, displaying error messages can be a security risk. Error messages may reveal information about your website, like path information and variables that should be kept secret.

The display_errors directive determines whether PHP will display error messages in users’ web browsers. To prevent PHP from displaying error messages, change the display_errors directive in the php.ini file using a text editor as follows:

display_errors = off

Modify the display_errors directive in the php.ini file  to allow PHP to display error messages as follows:

display_errors = on
You can use the phpinfo() function to check the current value of the display_errors directive and other directives. See this article for more information.

More Information

Was this article helpful?
Views: 376

10 Years Beehosting!
Celebrate with 70% OFF + FREE Site Transfer.

Facebook Instagram linkedin

Beehosting.pro website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Menu