Fix bin/magento taking all the RAM
While working with Magento 2.3.6 on Bixoto I hit a weird issue: the
bin/magento
command-line tool was always eating all the RAM, even with a simple command:
$ ./bin/magento --help
PHP Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 262144 bytes) in /home/baptiste/.../vendor/magento/module-store/Model/Config/Placeholder.php on line 146
Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.
The issue, as weird as it sounds, is an empty configuration value that causes Magento to end up in an infinite loop.
When I installed Magento on my local machine, I deactivated HTTPS by setting web/secure/base_url
to NULL
in the table core_config_data
. This alone is the cause of the issue.
Check in MySQL:
SELECT * FROM core_config_data WHERE path = 'web/secure/base_url' LIMIT 1;
If this shows a line with a NULL
value, either delete it or replace it with some non-null value:
UPDATE core_config_data SET value='http://...' WHERE path = 'web/secure/base_url' limit 1;
This has been reported to Magento but was closed because “it’s not a bug”. I don’t think
falling in an infinite loop on --help
because some config value is NULL
should really be a
normal behavior, but at least now you know how to solve it.