Tags
Asked 3 years ago
9 Jun 2021
Views 214
steave ray

steave ray posted

error reporting for single page in php?

how to turn on error reporting for single page in php?
jagdish

jagdish
answered Apr 25 '23 00:00

To turn on error reporting for a single page in PHP, you can use the ini_set() function to temporarily modify the error_reporting and display_errors settings for that page.

Here's an example:



<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);

// Your PHP code goes here

?>

The error_reporting setting controls which types of errors are reported. In this example, E_ALL is used to report all types of errors.

The display_errors setting controls whether errors are displayed on the screen or not. In this example, 1 is used to display errors on the screen.

Keep in mind that this method should only be used for debugging purposes and you should not leave error reporting turned on for production websites.
Post Answer