Tags
Asked 2 years ago
9 Jun 2021
Views 190
Cimb

Cimb posted

How do I get PHP errors to display?

How do I get PHP errors to display?
iptracker

iptracker
answered Apr 25 '23 00:00

To display PHP errors, you can use the following code at the beginning of your PHP script:



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

The error_reporting function sets the error reporting level to E_ALL , which includes all errors and warnings. The ini_set function sets the configuration option display_errors to 1 , which means that errors will be displayed on the screen.

Alternatively, you can set these values in your php.ini file. Locate the display_errors option and set it to On. And set the error_reporting option to E_ALL .

It is recommended to only display errors during the development phase of your project, and turn them off for the production environment to prevent sensitive information from being displayed to users.
Post Answer