Fatal error: Allowed memory size of 41943040 bytes exhausted in WordPress

Error in WordPress Toolkit when updating.

Selected items were updated with errors:
The following errors have occurred while updating WordPress instance #1 ('https://www.captainscbdshop.com'):
- Unable to update plugin 'akismet`4.1.12`1`', details: Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 20480 bytes) in /home/captainscbdshop/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/data-stores/ActionScheduler_DBStore.php on line 199
Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 20480 bytes) in /home/captainscbdshop/public_html/wp-includes/plugin.php on line 439

- Unable to update plugin 'creative-mail-by-constant-contact`1.4.6`1`', details: Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 32768 bytes) in /home/captainscbdshop/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/data-stores/ActionScheduler_DBStore.php on line 693
Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 32768 bytes) in /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/wp-cli/php-cli-tools/lib/cli/Colors.php on line 1

- Unable to update plugin 'jetpack`10.1`1`', details: Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 20480 bytes) in /home/captainscbdshop/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/data-stores/ActionScheduler_DBStore.php on line 199
Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 20480 bytes) in /home/captainscbdshop/public_html/wp-includes/plugin.php on line 439

- Unable to update plugin 'woocommerce`5.7.1`1`', details: Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 20480 bytes) in /home/captainscbdshop/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/data-stores/ActionScheduler_DBStore.php on line 199
Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 20480 bytes) in /home/captainscbdshop/public_html/wp-includes/plugin.php on line 439

- Unable to update plugin 'woocommerce-services`1.25.18`1`', details: Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 65536 bytes) in /home/captainscbdshop/public_html/wp-includes/widgets/class-wp-widget-rss.php on line 136
Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 65536 bytes) in /home/captainscbdshop/public_html/wp-includes/class-wp-fatal-error-handler.php on line 45

Checking for updates was performed with errors:
Failed to reset cache for the instance #1: Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 20480 bytes) in /home/captainscbdshop/public_html/wp-content/plugins/woocommerce/packages/action-scheduler/classes/data-stores/ActionScheduler_DBStore.php on line 509
Fatal error: Allowed memory size of 41943040 bytes exhausted (tried to allocate 4096 bytes) in /usr/local/cpanel/3rdparty/wp-toolkit/plib/vendor/wp-cli/vendor/composer/ClassLoader.php on line 427

Solution

In File Manager, Edit the file and change the lower memory limit:

public_html/wp-includes/default-constants.php

Change From:

// Define memory limits.
	if ( ! defined( 'WP_MEMORY_LIMIT' ) ) {
		if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
			define( 'WP_MEMORY_LIMIT', $current_limit );
		} elseif ( is_multisite() ) {
			define( 'WP_MEMORY_LIMIT', '64M' );
		} else {
			define( 'WP_MEMORY_LIMIT', '40M' );
		}
	}

Cange to:

// Define memory limits.
	if ( ! defined( 'WP_MEMORY_LIMIT' ) ) {
		if ( false === wp_is_ini_value_changeable( 'memory_limit' ) ) {
			define( 'WP_MEMORY_LIMIT', $current_limit );
		} elseif ( is_multisite() ) {
			define( 'WP_MEMORY_LIMIT', '64M' );
		} else {
			define( 'WP_MEMORY_LIMIT', '128M' );
		}
	}

In WordPress Toolkit, re-run check for updates. Now you can update.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.