Skip to content

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

Open

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

  1. swissspidy commented on Jun 2, 2026

    @swissspidy
    Member

    A bit surprising that this happens for wp plugin list, but keep in mind that CLI has very different code paths than a regular browser visit and there might even be different PHP versions or configuration files being loaded.

    It sounds like your default memory limit for CLI might be too low. See https://make.wordpress.org/cli/handbook/guides/common-issues/#php-fatal-error-allowed-memory-size-of-999999-bytes-exhausted-tried-to-allocate-99-bytes for workarounds.

    I also recommend updating to our latest nightly using wp cli update --nightly. Then, wp cli info will show you the exact memory limit it currently has.

  2. Luke-SF commented on Jun 2, 2026

    @Luke-SF
    Author
    $ php -i |grep memory_limit
    memory_limit => 748M => 748M
    

    There's already a pretty high memory_limit and the variable to increase it doesn't seem to work. Hosting dept says it shouldn't be increased in this environment.

    It's not just "wp plugin list" but every wpcli command, "wp user list" or just "wp" hits the limit too.

    wp
    
    mmap() failed: [12] Cannot allocate memory
    
    mmap() failed: [12] Cannot allocate memory
    Fatal error: W3TC\Generic_Plugin::ob_callback(): Cannot use output buffering in output buffering display handlers in ...../wp-content/plugins/forminator/addons/pro/googlesheet/lib/external/vendor/composer/autoload_static.php on line 9
    Warning: include(....../wp-content/plugins/forminator/library/external/vendor/composer/../composer/InstalledVersions.php): Failed to open stream: No such file or directory in ....../.wp-cli/packages/vendor/composer/ClassLoader.php on line 571
    Warning: include(): Failed opening '...../wp-content/plugins/forminator/library/external/vendor/composer/../composer/InstalledVersions.php' for inclusion (include_path='.:/opt/cpanel/ea-php84/root/usr/share/pear') in .../.wp-cli/packages/vendor/composer/ClassLoader.php on line 571
    
  3. Luke-SF commented on Jun 3, 2026

    @Luke-SF
    Author

    I think it is ulimit limiting it. No graceful fallback if ulimit memory limit kills the process?

  4. added a commit that references this issue on Aug 24, 2026
    d3bafc7
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