Meow Apps

How To: Debug WordPress

Something wrong happened while you were using a plugin in WordPress (freeze, or something similar) or your website is crashing with a blank screen, or anything else?

Checking your PHP Error Logs is the first reaction you should have. The PHP Error Logs is not the Access Error Logs (which is the error related to your web server and not PHP).

Where is the PHP Error Logs

You can access them through the admin given by your hosting service (not the WordPress one). Depending on your hosting service, they can also be accessed by an additional plugin (Error Log Monitor (Error Log Monitor) or even the Meow Apps Dashboard (at the bottom right on it you will find a link to your logs). They contain errors related to programming errors but also memory, space, and execution time issues.

Please note that the PHP Error Logs is rarely empty. Unfortunately, PHP Error Logs are not always accessible. If you find an empty file or no file at all, the logs might be disabled. Ask your hosting service to make sure. You must know if your logs are really working otherwise you will always have issues and never know where they come from.

There is an additional thread on StackOverflow where people are discussing this, have a look here: Where does PHP store the error log?

Check the Network activity

You will need to use Google Chrome. You can do it using other browsers but Google Chrome is the most convenient.

This is an important check, especially when a plugin is performing asynchronous actions (long-running process). Open your Google Chrome’s “Developer Tools” (https://developer.chrome.com/devtools) and click on the Network tab. Starts the process again until the issue occurs.

Go back to the Network tab, filter by XHR (those are the asynchronous requests, basically the discussion between your browser and the server, after the website has been loaded). Click on red colored request or the last request that was executed (in the left column, it’s usually admin-ajax.php) and look at the right window, in the XHR and Preview tab.

The Response tab might contain something interesting, like an error, or a broken reply from the server (if it is HTML, that’s also an issue as the message from the server is usually tiny and using JSON format). Please also check the Console window (look at the top of this window), as it might have some interesting information as well.

The Infamous Request Timeout

Those timeouts really depends on your WordPress install and your server. For each page load, or for each asynchronous requests (in the case of many Meow Apps plugins for example), WordPress (or actually, PHP) needs to load itself every time. All the plugins are also loaded at this time and every time and sometimes even perform a task. Generally, servers kill those tasks if they exceed 30 seconds. Nothing else will be displayed to you, the connection will be cut. What can you do?

If you are using Media Cleaner, be careful about the plugins you disable. If the plugins have an impact on how the content is used, it should be kept activated as Media Cleaner might use it (plugins such as ACF, WooCommerce or Visual Builders). You can also check the Advanced settings of Media Cleaner. Try to add a bit of delay (1000 or more) and lower the posts and analysis buffer (down to 5, or even less).