To monitor Apache errors in real-time on a cPanel server, follow the steps below:
Step 1: Connect via SSH
Log into your server as the root user or a user with sufficient privileges using SSH.
ssh root@your-server-ip
Step 2: Check the Apache Error Log
Run the following command to view the latest entries and monitor new ones as they appear:
tail -f /usr/local/apache/logs/error_log
Explanation:
tail
: Displays the end of a file.-f
: Follows the log in real-time as new lines are added./usr/local/apache/logs/error_log
: This is the main Apache error log location on cPanel/WHM servers.
Tip:
If you just want to see the last 100 lines without following in real-time:
tail -n 100 /usr/local/apache/logs/error_log
Or search for a specific error keyword:
grep "500" /usr/local/apache/logs/error_log
Use this to quickly troubleshoot Apache-related issues such as misconfigured .htaccess
rules, missing modules, or script errors.