21+ years in hosting · Jaipur, India · INR billing with 18% GST · 24/7 email support
Blog · WebJi® India

How to Check PHP Error Logs

Quick answer

PHP writes errors to the file set in its error_log setting, or to the web server's error log if that is empty. On cPanel, open Metrics → Errors or the error_log file beside the failing script. On a VPS, check the PHP-FPM pool log or the Nginx or Apache error log, and fix the first fatal error.

For developers and site owners tracing a blank page, a 500 error or a broken script back to the PHP line that caused it.

✓ In business since 2005
✓ INR + GST billing
✓ 24/7 Email Support — avg reply < 60 min
GuideWebJi®
knowledge
Read time
4 min
Sections
7
Updated
14 Nov 2026
Written by
WebJi® team

Where are PHP error logs stored?

PHP writes errors to the file named in its error_log setting; if that is empty, the messages go to the web server's error log instead. Where that ends up depends on the hosting type, so check these places in order.

Where PHP error messages usually land
SetupWhere to lookHow to open it
cPanel shared hostingerror_log file in the folder of the failing script (often public_html), plus the account's Errors listFile Manager with hidden files shown; cPanel → Metrics → Errors (last 300 entries)
Ubuntu/Debian VPS, PHP-FPMWeb server error log, unless the pool sets error_log; FPM's own log is /var/log/php8.3-fpm.logsudo tail -f /var/log/nginx/error.log or /var/log/apache2/error.log
AlmaLinux/Rocky VPS, PHP-FPM/var/log/php-fpm/www-error.log (set in the default www.conf pool)sudo tail -f /var/log/php-fpm/www-error.log
Apache with mod_phpApache error log/var/log/apache2/error.log or /var/log/httpd/error_log
WordPresswp-content/debug.log once WP_DEBUG_LOG is onSee the WordPress section below

Replace 8.3 with your PHP version. Reading the surrounding web server log is explained in Apache log files explained.

How to find the exact error_log path PHP is using

Ask the PHP that serves your website, not the command-line PHP, because the CLI and PHP-FPM read different ini files and can log to different places.

<?php
// save as check-log.php in the site folder, open it once in the browser, then DELETE it
echo 'error_log: ', ini_get('error_log') ?: '(web server log)', "\n";
echo 'log_errors: ', ini_get('log_errors'), "\n";
echo 'display_errors: ', ini_get('display_errors'), "\n";
echo 'loaded ini: ', php_ini_loaded_file(), "\n";

On a VPS, php -i | grep -E 'error_log|log_errors' shows the CLI settings only, which is useful for cron jobs and scripts. For FPM, check the pool file, for example grep -R "error_log" /etc/php/8.3/fpm/. Delete any diagnostic PHP file straight away; it reveals server paths to anyone who finds it.

Checking PHP error logs in cPanel

Open cPanel → Metrics → Errors, reload the broken page, and refresh the list; a new line with the current time naming a .php file and line number is your error.

  1. Log in to cPanel for the affected domain and open Metrics → Errors.
  2. Reload the failing URL, then refresh Errors.
  3. If nothing appears, open File Manager, enable Show Hidden Files, and look for error_log in the folder of the script that failed.
  4. Still nothing: logging may be off. Open MultiPHP INI Editor, choose the domain and, in Editor Mode, add log_errors = On; set display_errors to Off in Basic Mode.

These settings are saved to a .user.ini file in the document root. WebJi® cPanel hosting includes both the Errors screen and MultiPHP INI Editor.

How to read a PHP error log line

Each line has a timestamp, a severity, a message and the file and line where PHP stopped; fix the first fatal or parse error in a burst, because later warnings are often side effects.

[15-Nov-2026 10:42:07 Asia/Kolkata] PHP Parse error:  syntax error, unexpected token "}" in /home/user/public_html/inc/cart.php on line 58
[15-Nov-2026 10:42:09 Asia/Kolkata] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /home/user/public_html/db.php:12
Common PHP error messages and what to change
MessageEffectWhat to change
Parse error: syntax error, unexpected …File never runsThe punctuation at or just above the named line
Fatal error: Call to undefined functionRequest stopsA missing extension, a disabled plugin, or a function removed in newer PHP (e.g. mysql_* removed in PHP 7)
Fatal error: Allowed memory size exhaustedRequest stopsFind the loop or huge query first; raising memory_limit only hides it
Fatal error: Maximum execution time exceededRequest stopsSlow external call or import; move it to a background job
Warning: include(…): Failed to open streamPage continues, part missingThe path in the message
Deprecated / NoticePage continuesUpdate the code before the next PHP upgrade

If a fatal names a function removed in a newer PHP release, the site's PHP version changed under old code; read changing the PHP version in cPanel before switching back.

Setting up PHP error logging on a VPS

On a production server, log every error to a file and display none to visitors: log_errors = On, display_errors = Off, error_reporting = E_ALL, plus an explicit error_log path PHP can write to.

# /etc/php/8.3/fpm/pool.d/www.conf  (per-pool settings)
php_admin_flag[log_errors] = on
php_admin_value[error_log] = /var/log/php8.3-fpm-www-error.log
catch_workers_output = yes

sudo touch /var/log/php8.3-fpm-www-error.log
sudo chown www-data:www-data /var/log/php8.3-fpm-www-error.log
sudo systemctl reload php8.3-fpm
sudo tail -f /var/log/php8.3-fpm-www-error.log

Add the new file to logrotate so it cannot fill the disk. The PHP-FPM service name and user differ by distribution (php-fpm and apache or nginx on RHEL-family systems). Setting error_reporting to 0 silences the log as well, so never use it while you are still tracking a fault.

PHP error logs on WordPress sites

WordPress can keep its own PHP log at wp-content/debug.log: set WP_DEBUG and WP_DEBUG_LOG to true and WP_DEBUG_DISPLAY to false in wp-config.php. It captures notices and deprecations from plugins that the account log may filter out. Enabling it, reading entries and protecting the file are covered in checking WordPress error logs, and the folder layout on different panels in the WordPress error log location guide.

FAQ

Frequently asked questions

Why is my PHP error_log file huge?

A script is raising the same warning on every request, often a deprecated function after a PHP upgrade. Find the repeated line with sort error_log | uniq -c | sort -rn | head over SSH, fix that code, then empty the file. A large log can fill a shared plan's disk quota.

Why does my cron job error not appear in the website's log?

Cron runs PHP from the command line, which uses the CLI ini file and may log elsewhere or only to the cron email. Redirect its output, for example php job.php >> /home/user/logs/cron.log 2>&1, or set error_log inside the script.

Is it safe to show PHP errors on screen to debug faster?

Only on a staging copy. On a live site, displayed errors reveal file paths, database names and sometimes credentials. Keep display_errors off, watch the log with tail -f, and reproduce the fault yourself.

What is the difference between the PHP error log and a 500 error?

A 500 is what the visitor sees; the PHP log records why. Not every 500 comes from PHP, though: bad .htaccess rules or permission problems also cause it, and those appear in the web server log. Other causes are in 500 errors on cPanel hosting.

Checked 15 November 2026 against the PHP manual (error handling and FPM configuration) and cPanel documentation · Reviewed by the WebJi® team, Jaipur.

WebJi® since 2005

Ready to get started with WebJi®?

Join 12,000+ businesses across India and overseas. INR pricing, 18% GST shown before payment and 24/7 email support in Hindi and English — average first reply under 60 minutes.