Table of Contents
Background
WP / WordPress Toolkit is probably the go to feature of WHM’s cPanel hosting. However, at time, the scanner breaks down with nasty errors. We cover some examples in this article.
Fatal error: Allowed memory size of xxx bytes exhausted
Our first example is this:
Scanning for WordPress websites was performed with errors: Failed to register instance at '/home/example/public_html/new.example.co.za': Failed to reset cache for the instance #137: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10485760 bytes) in /home/example/public_html/new.example.co.za/wp-content/plugins/elementor/includes/elements/column.php on line 752
Looking at cPanel shows the memory limit is 512, so why 128 (134217728)?
First we try this also.:
define('WP_MEMORY_LIMIT', '64M');
Strangely, the scanner goes further, now the error is:
Fatal error: Uncaught Error: Call to undefined function Jvbpd\jvbpd_tso() in /home/example/public_html/new.example.co.za/wp-content/plugins/javo-core/inc/Roles.php
An second example is below:
WP_MEMORY_LIMIT issues 2
Scanning for WordPress websites was performed with errors: Failed to register instance at '/home/example/public_html': Failed to reset cache for the instance #104: [error]FailedToExecuteWpCliCommand: exit status 255[/error] Fatal error: Uncaught Error: Undefined constant "�WP_MEMORY_LIMIT�" in /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1343) : eval()'d code:104 Stack trace: #0 /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1343): eval() #1 /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1302): WP_CLI\Runner->load_wordpress() #2 /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start() #3 /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState)) #4 /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap() #5 /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/boot-fs.php(17): require_once('/usr/local/cpan...') #6 /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/wpt-wp-cli.php(31): require_once('/usr/local/cpan...') #7 Command line code(1): require('/usr/local/cpan...') #8 {main} thrown in /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1343) : eval()'d code on line 104 Failed to register instance at '/home/example/public_html': Failed to reset cache for the instance #105: [error]FailedToExecuteWpCliCommand: exit status 255[/error] Fatal error: Uncaught Error: Undefined constant "�WP_MEMORY_LIMIT�" in /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1343) : eval()'d code:104 Stack trace: #0 /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1343): eval() #1 /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1302): WP_CLI\Runner->load_wordpress() #2 /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start() #3 /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process(Object(WP_CLI\Bootstrap\BootstrapState)) #4 /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap() #5 /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/boot-fs.php(17): require_once('/usr/local/cpan...') #6 /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/wpt-wp-cli.php(31): require_once('/usr/local/cpan...') #7 Command line code(1): require('/usr/local/cpan...') #8 {main} thrown in /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1343) : eval()'d code on line 104
As you can see, it’s a right old mess. The problem isn’t the site’s memory limit, but rather the toolkit’s memory limit which is defined by the cPanel PHP binaries. How to fix? Read on.
Let’s tackle this issue first.
Why memory limit problem happens
WP Toolkit tries to bootstrap WordPress. It does so by checking the wp-config.php
file and finding some errors. In this instance, the error was this nasty line of code right at the end:
cat wp-config.php ... define(�WP_MEMORY_LIMIT�, �64M�);
Please also note first WP Toolkit couldn’t scan the folder because I had to delete this:
rm .wp-toolkit-ignore
Anyway, fixing the corrupted WP_MEMORY_LIMIT
with the correct line, e.g.:
define('WP_MEMORY_LIMIT', '64M');
Makes the scan go further.
Then we get this error, because now at least WP Toolkit can try to load the site:
Scanning for WordPress websites was performed with errors: Failed to register instance at '/home/example/public_html': Failed to reset cache for the instance #111: Fatal error: Uncaught Error: Call to undefined function create_function() in /home/example/public_html/wp-content/plugins/better-recent-posts-widget-pro/better-recent-posts-widget-pro.php:245
Next our Google needs refinement, so we google this:
Call to undefined function create_function() in /home/example/public_html/wp-content/plugins/better-recent-posts-widget-pro
Quickly we find out that we have a PHP 7/8 compatibility issue.
So this site is so old we cannot run the toolkit without downgrading to PHP 7.
Oops. The server doesn’t even have PHP 7 anymore. Moving it to a another server.
Timeout Issues
Another bad problem with WP Toolkit is related to timeouts. Here is an example:
Scanning for WordPress websites was performed with errors:
Failed to register instance at ‘/home/username/public_html’: Failed to reset cache for the instance #16: Unable to finish running an operation on this site in 60 seconds. Operation was canceled. This is most likely caused by a server load spike, uncommon directives in wp-config.php, or a malware infection. Try running the operation again later. If this problem persists, make sure there are no customizations in wp-config.php that could slow down parsing this file, and consider checking the website for viruses and malware.
Unfortunately this one sounds really nefarious and put the systems administrator into a spin thinking of all the 100s of sites, Houston, we have a problem.
Googling this is a nightmare. From working with Wordfence all we can say this is a false positive, but you might also find that your Wordfence scan is slow or doesn’t complete. Investigate this instead.
wp-toolkit --config -operation list | egrep "wpCliTimeoutHeavy|wpCliTimeoutMedium|wpCliTimeoutRegular|wpCliTimeoutMaintenanceTimeout"
WP Toolkit has a 60 second timeout. But should you change it? I don’t think so. If you have 100 sites and one site times out, then I certainly don’t recommend it.
W3 Total Cache was the culprit.