Find your error log
Where PHP and Apache errors are written, and how to read them when a page returns a blank screen or a 500.
Find the errors behind a blank page or a 500 error. Applies to shared, reseller and Premium hosting.
The log is the difference between guessing and knowing. A 500 error page says nothing; the log names the file and line.
Where to look
| Log | Location | Contains |
|---|---|---|
| Your site's PHP errors | error_log in the same directory as the script | Fatal errors, warnings, notices |
| Apache errors for the account | ~/logs/ | Server-level errors, permission failures |
| cPanel Errors | cPanel → Errors | The most recent entries, no SSH needed |
The one you usually want is error_log in your document root, or in whichever
subdirectory the failing script lives.
Read it
In File Manager, enable Show Hidden Files, then open error_log. The
newest entries are at the bottom.
Over SSH:
tail -n 50 ~/public_html/error_log
# watch it live while reproducing the problem
tail -f ~/public_html/error_logtail -f is the most useful: run it, trigger the error in a browser, and watch
the entry appear. That removes any doubt about which entry corresponds to your
problem.
What the entries mean
PHP Fatal error: Uncaught Error: Call to undefined function foo()
in /home/user/public_html/wp-content/plugins/example/file.php:42The file and line are the useful part. Here it is a plugin called example,
line 42.
- Fatal error — execution stopped. This is your blank page or 500.
- Warning / Notice — logged but execution continued. Usually noise, unless they correlate with the problem.
If there is no error_log
- PHP error logging is off for that directory. Enable it temporarily — see Enable error logging in a PHP script.
- The error is not from PHP. A 500 caused by
.htaccessor by file permissions appears in~/logs/, not inerror_log— see File and directory permissions. - You are looking in the wrong directory. Each directory gets its own
error_log. Search for it:find ~ -name error_log.
Delete it when you are done
error_log grows without limit, and a site erroring on every request can produce
a file large enough to fill your disk quota. Delete it once fixed — it is
recreated when needed.
Related
Why PHP-FPM is not available
WebGee runs LiteSpeed with mod_lsapi rather than PHP-FPM. What that means for you, and why the substitution is not a downgrade.
Set up a Node.js application
Deploy a Node.js app in cPanel — creating the application, installing dependencies, and the restart that most changes require.