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 TicketQuick 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 March 2026 · Browse all htaccess articles
