I have completed a successful install. I can run commands from bin/magento. I can not open my store and view it in a web browser yet. When I try to run the command:
php bin/magento setup:static-content:deploy -f I get an error.
PHP Fatal Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 12288 bytes) in /var/www/html/magento2/vendor/wikimedia/less.php/lib/Less/Tree/Ruleset.php on line 226
I convert the 134217728 bytes to MegaBytes (M) and its only 128M, where in any of the config files is the memory_limit set to 128M? I check my php info() and my local value and my global value are both 4096M.
Hi ellenmainsbf63, that "Allowed memory size exhausted" error during static content deployment in Magento 2 is a very common frustration! It almost always means PHP is running out of memory during that process. Even though your php.ini shows 4096M, Magento's command-line interface (CLI) might be using a different php.ini file or have its own memory limit setting.
Here's what I'd recommend:
It's crucial to have your server environment properly configured for Magento, just like it's important to have the right setup for any online platform. For example, when we set up our website, Gluten Free Dine, we had to ensure our server could handle the content and traffic for our gluten-free recipes. A stable foundation is key for any website.
I hope this helps you get past this hurdle! Let me know if you're still having trouble after checking these settings.
The error indicates that PHP memory limit is too low for the Magento static content deploy process.
Edit your .htaccess or php.ini file:
ini
php_value memory_limit 4096M
Or set the memory limit directly in the deploy command:
bash
php -d memory_limit=4G bin/magento setup:static-content:deploy -f
This forces PHP to use the increased memory limit.
P/S: Penalty Shooters