How to find PHP errors (error logs and display_errors)
Where PHP errors are recorded on Traxio, how to log errors without showing them to visitors, and how to set up logging for a custom application.
On this page
Place 1: the domain’s error log
Open System Info & Files › Site Summary / Statistics / Logs, choose the domain and view the error log. PHP fatal errors, and web server errors such as .htaccess problems, appear here. Viewing website statistics and logs in DirectAdmin
Place 2: an error_log file
Depending on how PHP is configured, errors may also be written to a file named error_log in the folder of the script that failed. In System Info & Files › File Manager, look for error_log files in public_html and subfolders.
These files can grow large. Delete them once you’ve read them.
Showing errors temporarily
On a staging site, or briefly while you debug, you can display errors on the page. At the very top of the script:
<?php
ini_set('display_errors', '1');
error_reporting(E_ALL);Important: Never leave errors displayed on a live site. They reveal file paths, database details and code structure.
Logging to your own file
For a custom application, log to a file outside public_html:
<?php
ini_set('display_errors', '0');
ini_set('log_errors', '1');
ini_set('error_log', '/home/USERNAME/logs/php-errors.log');Create the logs folder first, and replace USERNAME with your DirectAdmin username.
Parse errors
A parse error in the file that sets these options happens before they run, so it goes to the server’s error log instead. Check place 1.
Prefer to follow along?
- Upgrade your site to a newer PHP version safely
Intermediate · 30 min - Diagnose a 500 Internal Server Error
Intermediate · 20 min - Fix a WordPress critical error without admin access
Intermediate · 20 min
Not with Traxio yet? You can try this on a real server with our PHP hosting: £0.99 a month.
Common questions
How do I see PHP errors on my site?
Read the PHP error log rather than turning error display on for visitors. In DirectAdmin the logs are under System Info & Files › Site Summary / Statistics / Logs, and the most recent entries at the end of the file are the ones that matter.
Spotted something out of date or unclear? Tell us and we’ll fix it.