I am really stuck at the moment.

I keep getting the following error: "Your current PHP memory limit is 512M. Magento 2 requires it to be set to 756M or more. As a user with root privileges, edit your php.ini file to increase memory_limit. (The command php --ini tells you where it is located.) After that, restart your web server and try again."

When i speak to my hosting (go daddy) the confirm that i have it set to 756M, also when i check myself it shows the local memory as 756M. However when i try update or install and extension i get the error.

I have seen posts where people are saying its issues with cron but my cron seems to be running okay.

Any help would be greatly appreciated. Thanks Craig

  • Do you install your extensions by CLI? – lpFranz Jul 26 '18 at 19:09
  • No been trying via the GUI in the admin panel. Won't let me update or install anything due to the memory issue. – CraigShort Jul 26 '18 at 19:17
  • In this case I'm not able to help, if you use CLI to install, you can pass the -dmemory_limit to yout command, like this: php -dmemory_limit=512M bin/magento module:enable Vendor/Module – lpFranz Jul 26 '18 at 19:22
  • have u checked phpinfo. create .mediatemple.net/community/products/dv/204643880/… – Amit Bera Jul 27 '18 at 5:58

From the command line, copy and paste this as one command. Run it from the root of your Magento installation, aka the folder that contains your main index.php file.

find . -name '.htaccess' -exec sed -i '' s/756M/2048M/g {} + && \
find . -name '.htaccess' -exec sed -i '' s/768M/2048M/g {} + && \
find . -name '.user.ini' -exec sed -i '' s/756M/2048M/g {} + && \
find . -name '.user.ini' -exec sed -i '' s/768M/2048M/g {} +

There are several files that limit your php memory_limit. This targets those files and sets the max limit to 2048M.

On that note, 2048M is an ideal memory limit for Magento 2. The command above doesn't necessarily "give" you 2048M of memory, it just raises Magento's pre-set memory limit but you may still be capped elsewhere.

I should also mention that changing the memory limit in your htaccess file does not affect your command line memory limit, it affects the memory limit when accessing the site in a web browser.

| improve this answer | |
  • Cheers Shawn - I'll give this a bash. – CraigShort Jul 27 '18 at 10:28
  • Shawn - got the following error: sed: can't read s/756M/2048M/g: No such file or directory – CraigShort Jul 27 '18 at 13:24
  • In that case, just remove lines 1 and 3 from the command. It usually doesn't throw an error if it doesnt exist but on some operating systems it does. – Shawn Abramson Jul 27 '18 at 13:25
  • Still the same bro "sed: can't read s/768M/2048M/g: No such file or directory" – CraigShort Jul 27 '18 at 13:30
  • 3 questions. What operating system are you running this on? Are you certain you're running it from the root of your Magento installation(the one that contains the app, bin, vendor dirs)? Also, can you check that you have .htaccess, pub/.htaccess, .user.ini, and pub/.user.ini? – Shawn Abramson Jul 27 '18 at 13:42

I got same issue, This's my code to run it: php -d memory_limit=-1 bin/magento setup:upgrade.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.