How can error reporting be activated in PHP to ensure that exceptions are displayed properly?

To activate error reporting in PHP and ensure that exceptions are displayed properly, you can set the error_reporting level to E_ALL and enable display_errors in your php.ini file. This will make sure that all errors, warnings, and notices are displayed, including exceptions.

// Set error reporting level to display all errors
error_reporting(E_ALL);

// Enable displaying errors
ini_set('display_errors', 1);