Blog · WebJi® India

How to Check PHP Error Logs

Quick answer: On shared cPanel hosting, open Metrics, then Errors. That list is the last 300 PHP lines and needs no extra setup. WordPress also writes wp-content/debug.log once WP_DEBUG_LOG is true. On a VPS, read the PHP-FPM or Apache error log and fix the first fatal, not the last line.
✓ In business since 2005✓ INR + GST billing✓ 24/7 Email Support — avg reply < 60 min
Trader watching candlestick charts on several screens in the evening

Where do PHP error logs sit on cPanel, WordPress, and a VPS?

Check three places, in this order. The account log is first. The WordPress file is second. The VPS log is only for a fatal that never reached the account.

PlaceWhere you open itWhen it has the line
cPanel sharedMetrics, then Errors, or public_html/error_logPHP wrote to the account log
WordPresswp-content/debug.logWP_DEBUG_LOG is true
Linux VPSPHP-FPM log or the Apache error logThe fatal never reached the account file

Stop after the first two rows on shared hosting. Open the VPS log only when those files have no line from the minute you reloaded. If many lines share one second, edit the earliest fatal or parse error, then reload.

How do you open PHP error logs in cPanel?

On cPanel, the PHP error log for that account is Metrics, then Errors. It lists the last 300 messages. You do not create a file before you look.

  1. Log in to cPanel for the domain that failed. The client area is only for invoices and tickets.
  2. Open Metrics, then Errors.
  3. Reload the broken URL, then refresh Errors. A line at that time means this is the right log.
  4. If Errors is empty, open File Manager, show hidden files, and look for error_log in public_html.

You have the right log when the new line names a .php file and a line number. These screens ship with cPanel hosting.

How do you turn on the WordPress PHP debug log?

WordPress does not write a PHP error log until you ask. In wp-config.php, above the line that says to stop editing, set the three flags. The file is wp-content/debug.log.

define('WP_DEBUG', true); define('WP_DEBUG_LOG', true); define('WP_DEBUG_DISPLAY', false);

WP_DEBUG turns debugging on. WP_DEBUG_LOG writes the file. WP_DEBUG_DISPLAY set to false keeps the text off the public page.

Reload the URL that failed. In File Manager, open wp-content and confirm debug.log is new or larger. The guide to where WordPress stores the debug log maps that file if it is missing.

How do you read PHP error logs on a VPS?

On a VPS, PHP error logs are not under cPanel Metrics. Ask PHP which file it uses, then follow that file while you reload the site.

  1. SSH in as a user who can read the log.
  2. Run php -i | grep error_log and note the path. An empty value means PHP is using the web server log.
  3. Run tail -n 80 on that path. Try the PHP-FPM log, /var/log/apache2/error.log, or /var/log/httpd/error_log.
  4. Reload the site. Keep the file that gains a line with the current time.

Shared cPanel hosting has no shell for this. Stay on Metrics, then Errors, for those accounts.

How do you read one PHP error log line?

A PHP error log line is a timestamp, a level, a message, and a file with a line number. Fix the file named on the first fatal or parse error.

  • The timestamp should match the reload you just did. Older lines are a previous fault.
  • Parse and fatal stop the request. Warning and notice usually let the page continue.
  • The line number is where PHP stopped. A missing semicolon is often on the line above.

If a burst of warnings follows one fatal, ignore the warnings until that fatal is gone. Reload and read the log again.

Trader watching candlestick charts on several screens in the evening

What do the common PHP error log lines mean?

Most blank pages and broken plugins come from one of five PHP error log messages. Match the words, then open the file they name.

MessageWhat stoppedWhat to change
Parse error, unexpectedThe file never ranThe punctuation PHP names, often the line above
Fatal error: Uncaught, or call to undefinedThat request diedThe missing function, class, or a plugin that is off
Warning: failed opening or includePHP continuedThe path written in the message
Notice: undefined variable or indexPHP continuedSet the variable, after fatals are gone
Allowed memory size exhaustedThe request diedFind the loop first. A higher memory cap only hides it

A fatal that names a function removed in a newer PHP release is a version mismatch. Read that line before you change versions. Use how to change the PHP version in cPanel only after the log names the function.

How do you turn PHP error logging on without showing visitors?

Turn PHP logging on, and turn the on-screen display off. The log still records the fault. Visitors no longer see the file path or the line number.

  1. In cPanel, open MultiPHP INI Editor and select the domain.
  2. Set log_errors to On, display_errors to Off, and error_reporting to E_ALL. Save.
  3. Reload the site. Metrics, then Errors, should gain a line. If it does not, the error_log path is wrong or the folder is not writable.

To turn off error reporting on a live site, set display_errors to Off. Do not set error_reporting to 0 while you are still hunting the fault, or the log goes quiet too. Leave log_errors On.

If you used a one-file phpinfo page to read the error_log path, delete that file once you have the path. Do not leave it on the public site.

Frequently Asked Questions

Where are PHP error logs in cPanel?

Open cPanel for that domain, then Metrics, then Errors. The screen lists the last 300 messages for the account. The same text is often in public_html/error_log in File Manager. An empty screen means PHP is not writing a log yet. Turn log_errors on in MultiPHP INI Editor and reload the page.

How do I enable error logging in WordPress?

In wp-config.php, above the stop-editing line, set WP_DEBUG and WP_DEBUG_LOG to true and WP_DEBUG_DISPLAY to false. Reload the broken page. File Manager should show a new or larger wp-content/debug.log. Empty that file after the fix so it does not grow in public.

What is error_log in PHP?

error_log is a php.ini path and a PHP function. The path is where PHP writes warnings and fatals. The function error_log() sends one message to that file, to an email address, or to a path you pass in. On cPanel the path is usually the account log that Metrics, then Errors, displays.

How do I see PHP errors in the terminal?

SSH to the VPS and run php -i, then find the error_log path. Follow it with tail -n 80 and that path. Reload the site. A new line with the current time means you have the right file. A shared cPanel account has no shell for this. Use Metrics, then Errors, instead.

What do PHP warnings and notices mean?

A warning means PHP hit a problem and continued, such as a missing include. A notice is smaller, such as an undefined index, and the page still ran. A fatal error or a parse error stopped that request. Fix the first fatal or parse line. Warnings after it are often side effects.

How do I fix a blank page using error logs?

A blank page while display_errors is off is usually a fatal that never reached the browser. Open Metrics, then Errors, or wp-content/debug.log, and find the newest PHP Fatal error. The path and line number name the file to edit. Fix that line, reload, and confirm the fatal no longer appears.

Need help with this?

WebJi® support does it for you — free. Talk to our Jaipur team →