Skip to content

WPCLI often gets out of memory error, while the site runs fine. #6326

Description

@Luke-SF

Bug Report

--- ✅ If you are in the correct location now... --->

Describe the current, buggy behavior

Sometimes wp cli can run out of memory, while site itself is fine and not hitting the limit. This seems to be common among those sites with many large plugins. For example, one had these:

 wp plugin list --skip-plugins
+---------------------------+----------+-----------+---------+----------------+-------------+
| name                      | status   | update    | version | update_version | auto_update |
+---------------------------+----------+-----------+---------+----------------+-------------+
| all-in-one-wp-migration   | inactive | none      | 7.105   |                | off         |
| all-in-one-seo-pack       | inactive | none      | 4.9.7.2 |                | off         |
| pojo-accessibility        | active   | none      | 4.1.2   |                | on          |
| better-payment            | inactive | none      | 2.1.2   |                | off         |
| better-search-replace     | inactive | none      | 1.4.10  |                | on          |
| duplicate-page            | inactive | none      | 4.5.9   |                | off         |
| elementor                 | active   | none      | 4.1.1   |                | off         |
| elementor-pro             | active   | none      | 4.1.0   |                | off         |
| forminator                | active   | none      | 1.54.0  |                | on          |
| give                      | active   | none      | 4.15.3  |                | on          |
| image-optimization        | active   | none      | 1.7.4   |                | on          |
| mailpoet                  | active   | none      | 5.28.0  |                | off         |
| optinmonster              | inactive | none      | 2.16.24 |                | off         |
| reftagger                 | active   | none      | 2.4.7   |                | on          |
| sf-media                  | active   | none      | 1.3.4   |                | on          |
| google-site-kit           | active   | available | 1.179.0 | 1.180.0        | off         |
| site-mailer               | inactive | none      | 1.4.4   |                | off         |
| sliced-invoices           | inactive | none      | 3.10.0  |                | off         |
| analogwp-templates        | active   | none      | 2.6.5   |                | off         |
| the-events-calendar       | active   | none      | 6.16.3  |                | off         |
| boldgrid-backup           | inactive | none      | 1.17.2  |                | off         |
| userfeedback-lite         | inactive | none      | 1.11.2  |                | off         |
| w3-total-cache            | active   | none      | 2.9.4   |                | on          |
| wp-file-manager           | inactive | none      | 8.0.4   |                | off         |
| wpforms-lite              | active   | none      | 1.10.1  |                | on          |
| wp-mail-smtp              | active   | none      | 4.8.0   |                | on          |
| wp-statistics             | active   | none      | 14.16.8 |                | on          |
| wpvulnerability           | active   | none      | 5.0.0   |                | on          |
| wordpress-seo             | active   | none      | 27.7    |                | on          |
| advanced-cache.php        | dropin   |           |         |                | off         |
+---------------------------+----------+-----------+---------+----------------+-------------+

Andy wpcli command results in an error without "--skip-plugins":

wp plugin list
mmap() failed: [12] Cannot allocate memory
mmap() failed: [12] Cannot allocate memory
...

Describe how other contributors can replicate this bug

  • Install many many plugins
  • Try a wp cli command.

Describe what you expect as the correct outcome

WPCLI should run and run without exceeding memory limit while the site itself isn't hitting the limit.

Let us know what environment you are running this on

OS:	Linux 4.18.0-553.80.1.el8_10.x86_64 #1 SMP Mon Oct 20 03:57:49 EDT 2025 x86_64
Shell:	/usr/local/cpanel/bin/jailshell
PHP binary:	/opt/cpanel/ea-php84/root/usr/bin/php
PHP version:	8.4.21
php.ini used:	/opt/cpanel/ea-php84/root/etc/php.ini
MySQL binary:	/usr/bin/mariadb
MySQL version:	mariadb  Ver 15.1 Distrib 10.11.18-MariaDB, for Linux (x86_64) using readline 5.1
SQL modes:
WP-CLI root dir:	phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir:	phar://wp-cli.phar/vendor
WP_CLI phar path:	phar:///usr/local/cpanel/3rdparty/share/cpanel-wp-cli/wp-cli.phar
WP-CLI packages dir:	/home/.../.wp-cli/packages/
WP-CLI cache dir:	/home/sf927076/.wp-cli/cache
WP-CLI global config:	/home/.../.wp-cli/config.yml
WP-CLI project config:
WP-CLI version:	2.12.0

Provide a possible solution

There doesn't seem to be a solution other than temporarily disabling some plugins. The website/dashboard doesn't seem to have the issue.

Provide additional context/screenshots

N/A

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions