How can error reporting be used effectively in PHP to troubleshoot issues with including files?

When including files in PHP, issues can arise due to incorrect file paths or permissions. To troubleshoot these issues, error reporting can be used to display specific error messages that can help identify the problem. By enabling error reporting and setting the appropriate level of reporting, developers can quickly pinpoint the root cause of file inclusion errors.

// Enable error reporting to display all errors
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Include the file with the correct path
include 'path/to/file.php';