{"id":57605,"date":"2020-09-30T10:53:27","date_gmt":"2020-09-30T15:53:27","guid":{"rendered":"https:\/\/blog.cpanel.com\/?p=57605"},"modified":"2020-09-30T10:53:27","modified_gmt":"2020-09-30T15:53:27","slug":"how-to-monitor-php-error-logs-in-wordpress-and-cpanel","status":"publish","type":"post","link":"https:\/\/devel.www.cpanel.net\/blog\/tips-and-tricks\/how-to-monitor-php-error-logs-in-wordpress-and-cpanel\/","title":{"rendered":"How to Monitor PHP Error Logs in WordPress and cPanel"},"content":{"rendered":"\n

PHP error logs are one of the most useful tools for diagnosing web hosting issues. It\u2019s often difficult to find the cause of unexpected behavior in WordPress\u00ae and other PHP applications. PHP error logs, including WordPress logs,  can help you to spot problems and identify the offending plugin, theme, or custom code. <\/p>\n\n\n\n

In this article, we describe what PHP error logs are and why they\u2019re useful, before explaining how to use cPanel & WHM to activate and configure both WordPress logs and the PHP runtime\u2019s logging functionality.  <\/p>\n\n\n\n

What is a PHP Error Log?<\/strong><\/h2>\n\n\n\n

A PHP error log lists warnings and error messages, which are generated by the language runtime and saved to a file. WordPress is written in PHP, so it handles WordPress\u2019s error messages and logging. <\/p>\n\n\n\n

Errors occur for lots of reasons. A line of code might have a typo in it, or the code might be fine, but something unexpected happens when it\u2019s executed. Either way, the developers want to let you know, so they write code to log a message to a file. Error logs are a time-ordered list of these messages. <\/p>\n\n\n\n

Error logs are incredibly useful for figuring out why WordPress isn\u2019t behaving as you think it should. If it\u2019s consuming excessive server resources, a plugin is broken, or pages don\u2019t load, the logs can tell you why. If you\u2019re in a \u201cWhite Screen of Death\u201d situation where WordPress isn\u2019t working at all, the logs might be the only way to see what\u2019s going on under the hood.<\/p>\n\n\n\n

How to Monitor WordPress Logs in cPanel<\/strong><\/h2>\n\n\n\n

Before you can troubleshoot with logs, you\u2019ll need to tell WordPress or PHP to start logging. Error logs are off by default because logging consumes server resources.  They can also be a security risk if the wrong person sees them; logs sometimes have clues about potential vulnerabilities. <\/p>\n\n\n\n

We\u2019re going to look at two approaches to configuring error logging in cPanel. They are:<\/p>\n\n\n\n