Displaying PHP errors without modifying php.ini
By default, PHP doesn't show errors on your website. That's safer, because an error message sometimes contains information that isn't meant for visitors. If you're tracking down an error, you can temporarily turn error messages on.
Viewing the error log
Often the error is already in the error log. You'll find it in DirectAdmin under System Info & Files, Site Summary / Statistics / Logs.
Temporarily showing errors
Put these lines at the top of the script (or in index.php):
ini_set('display_errors', 1);
ini_set('log_errors', 1);
ini_set('error_log', __DIR__ . '/error_log.txt');
error_reporting(E_ALL);
An error in the same file that contains these lines is sometimes not shown. In that case, create a new script with these lines and load the old script into it with include.
You can also turn on display_errors in DirectAdmin under PHP Settings, or in Select PHP version under Options.
error_log.txt. If it's in a folder of your website, anyone who knows the name can read it.See also in the DirectAdmin manual: Site summary and logs: the error log and the access log.
Detailed explanation with screenshots: Errors after a PHP upgrade and finding the error log in the DirectAdmin manual.
