"If a worker wants to do his job well, he must first sharpen his tools." - Confucius, "The Analects of Confucius. Lu Linggong"
Front page > Programming > How Can I Suppress Strict Standards Errors in PHP 5 While Still Logging Them?

How Can I Suppress Strict Standards Errors in PHP 5 While Still Logging Them?

Posted on 2025-02-06
Browse:825

How Can I Suppress Strict Standards Errors in PHP 5 While Still Logging Them?

Disabling Strict Standards Error Reporting in PHP 5

To disable strict standards error reporting in PHP 5, modify the start of your script with the appropriate functions. It's recommended to log errors even in production environments for analysis purposes.

// Suppress error display
ini_set('display_errors', '0');

// Report all errors (including strict standards) but do not display them
error_reporting(E_ALL | E_STRICT);

These settings will prevent error messages from being shown to users while still allowing them to be logged to the system log. You can also utilize the error_log directive to specify a specific destination for error logging. By separating error logging from error display, you can retain valuable error information for debugging while providing a clean and user-friendly interface to your end users.

Latest tutorial More>

Disclaimer: All resources provided are partly from the Internet. If there is any infringement of your copyright or other rights and interests, please explain the detailed reasons and provide proof of copyright or rights and interests and then send it to the email: [email protected] We will handle it for you as soon as possible.

Copyright© 2022 湘ICP备2022001581号-3