Repository navigation
Description
Bug Report
--- ✅ If you are in the correct location now... --->
- Yes, I reviewed the contribution guidelines.
- Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
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
swissspidy commentedon Jun 2, 2026
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 infowill show you the exact memory limit it currently has.Luke-SF commentedon Jun 2, 2026
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.
Luke-SF commentedon Jun 3, 2026
I think it is ulimit limiting it. No graceful fallback if ulimit memory limit kills the process?
Detect restrictive OS-level ulimit -v and warn in `wp cli info`
Add Behat scenario reproducing the ulimit -v mmap warning