The error_log file in your public_html directory captures PHP errors. If it is growing large or you want to disable error logging to a file, you can control this through .htaccess or .user.ini.
Disable logging or redirect it
Add to .user.ini in public_html:
log_errors = Off (disables file logging entirely)
or
error_log = /home/username/logs/php_errors.log (logs to a different location outside public_html)
01. Disable Error Logging
Create or edit .user.ini in your public_html:
log_errors = Off
Disabling error logging means you lose visibility into PHP issues on your site. If your site breaks, there is no log to diagnose the problem. A better approach is to redirect the log or manage its size.
02. Redirect the Log (Better Option)
If the issue is that error_log is publicly accessible or growing too large in public_html, move it outside the web root:
error_log = /home/username/logs/php_errors.log
Create the logs directory first: mkdir ~/logs
03. Hide Display Errors (Keep Logging)
If you want to keep logging errors to a file but stop showing them to visitors in the browser:
display_errors = Off
log_errors = On
This is the recommended production setting. Errors are written to the log file for you to review, but visitors see a clean error page instead of PHP stack traces.
04. The error_log File Is Huge
It is safe to delete error_log. A new one is created automatically when the next error occurs:
rm ~/public_html/error_log
If it keeps growing quickly, fix the underlying PHP errors rather than just deleting the file. Check cPanel > Metrics > Errors for the most recent entries.
For more on .htaccess and PHP configuration, see Complete Guide to .htaccess.
Constant PHP Errors?
If your error_log is filling up rapidly, there is likely a code or plugin issue. Open a ticket with a few sample lines from the log.
Open a Support TicketFrequently Asked Questions
How do I disable the PHP error_log file?
Add php_flag log_errors off to .htaccess, or set log_errors = Off in a .user.ini or the MultiPHP INI Editor. A better option is to redirect the log to a path outside public_html instead of disabling it, so you keep errors for debugging without the file bloating your web root.
Should I disable error logging entirely?
Usually not. Redirect the log to a file outside public_html with php_value error_log /home/user/php_errors.log so you keep the errors but control where they go. Turn off display_errors on production, but keep logging for troubleshooting.
My error_log file is huge, what do I do?
It means a script is erroring repeatedly. Open the file to find the recurring error and fix the cause rather than just deleting it, since it refills. You can safely delete or truncate it after noting the error; it regenerates.
How do I hide errors from visitors but keep logging?
Set display_errors off so visitors never see errors, while leaving log_errors on with error_log pointing at a file. Visitors get clean pages and you still have the log to debug from.
Quick Recap
- Disable logging -
log_errors = Offin .user.ini (not recommended) - Redirect the log outside public_html (better option)
- Hide from visitors -
display_errors = Offwithlog_errors = On - Safe to delete the error_log file, it recreates automatically
- Fix the errors rather than just hiding them
PHP error management · Last updated November 2026 · Browse all htaccess articles
