What are best practices for error reporting in PHP to avoid blank pages?

To avoid blank pages in PHP error reporting, it is recommended to set error reporting to display errors on the screen and log them to a file simultaneously. This way, users will see errors on the screen while developers can also review them in the log file for debugging purposes.

// Display errors on screen
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

// Log errors to a file
ini_set('log_errors', 1);
ini_set('error_log', 'error.log');