00 Votes

PHP: Show all error messages for debugging

Question by Guest | 2016-02-24 at 09:07

By default, you should configure your PHP in a way that error messages are not displayed so that no one from outside can make conclusions because of such a message.

Nevertheless, I would like to show all errors for debugging for a very short time, so that I can see whether there is going something wrong. Is there any specific function for that available in PHP?

ReplyPositiveNegative
0Best Answer0 Votes

Yes, with using the function error_reporting() it is possible to manage which errors should be displayed.

To ensure that all errors are displayed, you can pass E_ALL:

error_reporting(E_ALL);

In order to turn the error reporting off and to ensure that errors will not be displayed 0 as a parameter:

error_reporting(0);

However, it is also possible to only show a specific connection off individual errors. You can achieve this with passing the appropriate constants:

error_reporting(E_WARNING | E_PARSE);

In this case, we only want to show warnings and paser errors. You can find a list of all constants that are available here.

By the way, instead of calling error_reporting(E_ALL) you can also use ini_set('error_reporting', E_ALL).
2016-02-24 at 11:41

ReplyPositive Negative
Reply

Related Topics

PHP: Current Date and Time

Tutorial | 0 Comments

Important Note

Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.

Participate

Ask your own question or write your own article on askingbox.com. That’s how it’s done.