Troubleshooting

Find and fix PHP errors using error_log on cPanel hosting

Locate PHP errors in error_log files and cPanel Errors, read fatal errors and warnings correctly, enable safe debugging and fix the most common PHP messages.

IntermediatecPanel hosting2 min read

When a PHP site shows a blank page, a 500 error or a broken feature, PHP almost always writes the reason to a log. Learning to find and read that line turns guesswork into a five-minute fix.

Before you start

Where PHP errors are logged

  • error_log files: in cPanel → Files → File Manager, look for a file named error_log in the folder of the script that failed (for example public_html/error_log or public_html/wp-admin/error_log). Enable Settings → Show Hidden Files if needed.
  • cPanel → Metrics → Errors: the last web server errors for your account.
  • More on both: cPanel error log and raw access logs.

Read an error line

[13-Nov-2026 09:12:44 UTC] PHP Fatal error:  Uncaught Error: Call to undefined function mysql_connect() in /home/user/public_html/inc/db.php:14

Read it left to right: time, severity, message, then the file and line. Fix the newest Fatal error first; warnings and notices rarely break a page.

SeverityEffect
Fatal error / Parse errorScript stops; blank page or 500
WarningScript continues; something may not work
Notice / DeprecatedHarmless now, but will break in a future PHP version

Fix the most common PHP errors

MessageFix
Allowed memory size of ... bytes exhaustedRaise memory_limit; see memory exhausted fix
Call to undefined functionMissing PHP extension or removed function; enable the extension or update the code
syntax error, unexpected ...Typo in the named file and line, or code written for a newer PHP version
Maximum execution time of 30 seconds exceededRaise max_execution_time or fix the slow task
Failed opening requiredMissing file or wrong path after a move

Change PHP version and settings

  1. Pick the PHP version in cPanel → Software → Select PHP Version (CloudLinux) or MultiPHP Manager. Guide: Select PHP version and extensions.
  2. Enable missing extensions on the Extensions tab.
  3. Adjust memory_limit, max_execution_time and upload_max_filesize on the Options tab.

Turn on debugging safely

Never show errors to visitors on a live site. Log them instead. For WordPress, add to wp-config.php above That's all, stop editing:

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

Errors then go to wp-content/debug.log. Set WP_DEBUG back to false when you're done, and delete the log.

Warning: Large error_log files use disk space and inodes. Fix the repeating error, then delete the file.

Next steps

Was this guide helpful?

Still stuck?

Ask MdmHost AI for a quick answer, or open a ticket and our team will take a look. We are here 24/7.