How to Enable PHP Error Reporting in DirectAdmin
If your website displays a blank page, a 500 Internal Server Error, or does not work as expected, enabling PHP error reporting temporarily can help you identify the problem.
Follow the steps below to enable PHP error reporting through your NetrillerHost DirectAdmin hosting account.
Step 1: Log in to DirectAdmin
- Log in to your NetrillerHost DirectAdmin control panel.
- Navigate to File Manager.
- Open the
domainsdirectory, then your domain'spublic_htmldirectory.
Your website files are typically located at:
domains/yourdomain.com/public_html/
Step 2: Create a .user.ini File
- Open your website's
public_htmldirectory. - Create a new file named
.user.ini. - If the file already exists, open it for editing instead of creating a duplicate.
Note: If your File Manager does not display hidden files, enable the option to show hidden files if available.
Step 3: Add the PHP Error Reporting Settings
Open .user.ini and add the following configuration:
error_reporting = E_ALL display_errors = On display_startup_errors = On log_errors = On
Save the file.
These settings instruct PHP to report errors and display them in the browser, where supported by your hosting configuration.
Step 4: Test Your Website
- Open your website in a browser.
- Revisit the page that was producing the error.
- Check whether PHP displays an error message.
- If an error appears, note the error description and line number to help identify the problem.
Important: PHP-FPM may take a short time to apply .user.ini changes. Also, your hosting configuration may override or restrict some settings.
Step 5: Disable Error Display After Troubleshooting
For security, you should not leave PHP errors visible to website visitors.
Once you have identified the problem, replace the settings with:
error_reporting = E_ALL display_errors = Off display_startup_errors = Off log_errors = On
Save the file.
PHP errors will continue to be logged, but they will no longer be displayed publicly, provided the hosting configuration permits these settings.
Alternative: Enable Error Reporting in PHP Code
If you cannot configure .user.ini, you may temporarily add the following lines near the beginning of a PHP file, immediately after the opening <?php tag:
error_reporting(E_ALL); ini_set('display_errors', '1'); ini_set('display_startup_errors', '1'); ini_set('log_errors', '1');
This method only works if the hosting configuration allows the script to change these settings. It may not display errors that occur before the code executes, such as PHP syntax errors in the same file.
Still Unable to See PHP Errors?
If errors are still not displayed:
- Check your hosting account's PHP version and PHP execution mode.
- Check the PHP error log or your domain's available error logs in DirectAdmin.
- Confirm that your hosting configuration allows
.user.inioverrides. - Contact NetrillerHost support if you need help accessing your PHP error logs.
Security recommendation: Enable visible errors only while debugging. Never publish database passwords, API keys, or other sensitive information in error messages.