Home » Php » php – Suppress the message "Fatal error: Maximum execution time of 30…"

php – Suppress the message "Fatal error: Maximum execution time of 30…"

Posted by: admin July 12, 2020 Leave a comment

Questions:

I’m using register_shutdown() to provide show a page if upload takes a long time causing a PHP timeout. I really don’t need to show the fatal error to the user, how can hide that message?

How to&Answers:

You would want to set the display_errors directive in your php.ini to off on your production machine. Alternatively if your script doesn’t have any fatal errors beyond the timeout issue you may use ini_set to turn off displaying errors at runtime.

Answer:

To hide the error message, you can use error_reporting(E_NONE) to suppress all error messages.

Or, you can just do a ini_set('display_errors','0'); to hide the error messages from being displayed, and log them.