5

I installed magento 2 and is working fine. I am trying to install through the component manager an extension (magento mag/module blog). I keep getting the message:

"PHP Settings Check: Your current PHP memory limit is 128M. 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."

My php.ini is in my public_html folder (same as magento 2 installation) and is set to 756M, yey i keep getting the same message...any help? If I try to install any of the other magento updates I have in the component manager, I get the same message.

1

5 Answers 5

3

2 things you need to remember:

  • memory limit is set in basic php.ini file, most often in location like /etc/php/X.X/fpm/php.ini and /etc/php/X.X/cli/php.ini (this varies depending on the system and whether you use php as a service or not). Those settings also tells php whether you can override those default values with your custom ones in php.ini file in your document root folder.

  • as you noticed above there are 2 paths for php.ini. If you use php-fpm then you have 2 independent settings for php run via apache/nginx as a response to http request and another set of settings for scripts run from the console (ie. bin/magento or composer).

Now if your system tells you memory limit is 128M then it does not lie. Either your default settings forbids you from settings memory limit in project folder or vhost settings points not to the file you are using to change the settings.

1

I had a similar issue and finally found a solution (after 2 full days of troubleshooting and zero luck with technical support).

My phpinfo.php file listed a 2G memory_limit and a master value of 512M but Magento 2 readiness check kept telling me 512 was set.

Setup: Magento 2.2.5, PHP version: 7.0.3

Godaddy Business Hosting (Grow) - This is comparable to a shared hosting service but with allocated resources similar to a VPS server. You cannot modify the master php file but you can add your own .user.ini file to rewrite scripts.

The main issue is that this shared server has the option to select multiple PHP versions (MultiPHP Manager). When you select your version (in this case PHP 7.0), be sure to not to modify any of the "Switch to PHP Options" settings. Adding extensions are fine (you will need to add xsl and zip anyway to use Magento 2). If you modify any of the settings in the "PHP Options" console, it will call these master values every time. Leave them all as default (128M memory_limit, etc). In my case, I modified it to 512M from the default 128M and spent countless hours trying to troubleshoot why it was reading 512M instead of my local 2G value.

Be sure to set up the proper cron jobs to call your local .user.ini file with the correct memory_limit value.

Cron jobs looked like this:

/usr/local/bin/php -c /home/<USERNAME>/public_html/.user.ini /home/<USERNAME>/public_html/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /home/<USERNAME>/public_html/var/log/magento.cron.log

/usr/local/bin/php -c /home/<USERNAME>/public_html/.user.ini /home/<USERNAME>/public_html/update/cron.php >> /home/<USERNAME>/public_html/var/log/update.cron.log

/usr/local/bin/php -c /home/<USERNAME>/public_html/.user.ini /home/<USERNAME>/public_html/bin/magento setup:cron:run >> /home/<USERNAME>/public_html/var/log/setup.cron.log

Notice the local .user.ini file being called after the master php folder instead of the file php -i was telling me to call (/opt/alt/php70/etc/php.ini).

Don't know if these two steps were necessary but I did it anyway:

Flushed cache in ssh

php /home/<USERNAME>/public_html/bin/magento cache:flush

Kill PHP Processes to restart (cPanel > PHP Processes > Kill Processes)

Note - I also updated my .htaccess file to a 2G memory_limit as well just to keep things consistent.

I checked my update.log file and the errors are no more. I also ran a readiness check and it finally passed.

Hope this helps everyone else.

0

Insert below code in your index.php

ini_set('memory_limit', '1024M');

Set memory limit as your requirements.

Reference

https://stackoverflow.com/a/30254056/5577053

1
  • i dont know why this is downvoted... magento itselfs uses the .htaccess to set the memory_limit. Not every system uses Apache, so not every system can work with .htaccess files
    – ZFNerd
    Commented May 16, 2018 at 8:12
0

Run this command:

which php

You will get the path of you PHP version which is using.

The path will be like: /../../../<php7.0.15>/bin/php. (7.0.15 is your version)

Direct to the folder ../<php7.0.15>/bin you will see the php.ini file. Edit the line memory_limit to 2048 or more.

0

i had some issues and no one mentioned that it could be because of the nginx config. i found it by grep -R' on the nginx.conf.sample. also it needs reload nginx service. sudo service nginx restart`

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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