Meow Apps

Debugging WordPress

Navigation Close

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

Usually, you can access them through the administration system shared by your hosting service (not the WordPress one; it can be Plesk, cPanel, or their own system).

Depending on how your hosting service set up your environment, they can also be accessed thanks to plugins (try Error Log Monitor) or even the Meow Apps Dashboard (at the bottom right on it you will find a link to your logs).

PHP Error Logs contain errors related to programming errors but also memory, space, and timeout issues. They are really important to troubleshoot issues.

Please note that the PHP Error Logs is rarely empty (as warnings are also logged in them). 

Unfortunately, PHP Error Logs are not always made accessible by the hosting services, especially the cheap ones. If you find an empty file (or no file at all), the logs might be disabled.

If you can’t find them, or if they are empty and you have issues, contact your hosting service and ask them for access to your PHP Error Logs (and if they are good, for troubleshoot about your issue at the same time).

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) load itself every time. I know, it doesn’t sound very productive, but this is how it works. All the plugins are loaded every time, sometimes even performing tasks, checking updates, etc. In fact, that is my biggest complain about PHP! Knowing that, you understand how it is to keep WordPress as light as possible.

Generally, servers kill requests when they exceed 30 seconds. Nothing else will be displayed to you, the connection will just be cut. What can you do? Basically, only two.

  1. Make sure your WordPress is optimized, using the latest version of PHP, a maximum of plugins running, etc. Check this: https://meowapps.com/clean-optimize-wordpress/.
  2. Increase the execution timeout in PHP. Have a look at this thread on StackOverflow: How to increase the Execution Timeout.

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 them (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).