Tags
Asked 2 years ago
9 Jun 2021
Views 178
eclipse-learner

eclipse-learner posted

Turning error reporting off php

Turning error reporting off php
steave

steave
answered Apr 25 '23 00:00

In PHP, you can turn off error reporting using the error_reporting function. Setting the error_reporting level to 0 will turn off all error reporting.

Here's an example:



// Turn off all error reporting
error_reporting(0);

Alternatively, you can set the display_errors configuration option in the php.ini file to Off to turn off error reporting.



display_errors = Off

It's worth noting that turning off error reporting may not be the best practice, especially in a production environment, as it can make it difficult to troubleshoot errors. It's recommended to log errors to a file or a database instead of displaying them on the screen.
Post Answer