1

I know this is a repeated question, but I couldn't find a solution after trying all the answers discussed here.

When I run php bin/magento setup:upgrade command, it shows error like

PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 12288 bytes) in /var/www/html/mysite/vendor/paragonie/sodium_compat/lib/sodium_compat.php on line 214

Modified memory_limit value in php.ini file, but still issue exists. Any other solutions for this problem?

2
  • 1
    Make sure you edited the correct php.ini. PHP executed via the web server, and run via command line, often use two different ones. Call phpinfo via CLI, and check what it says which config file was actually used. Commented Feb 14, 2020 at 10:20
  • If I am not mistaken 2097152 bytes in only 2.1Meg? That means something in your system is limiting PHP memory to almost nothing Commented Feb 14, 2020 at 10:31

2 Answers 2

5

Make sure you edited the correct php.ini.PHP executed via the web server, and run via command line, often use two different ones

Just add this below line to before line of you getting error in your file

ini_set('memory_limit', '-1');

It will take unlimited memory usage of server.

OR

  1. in yourr PHP.ini file, change the line in PHP.ini If your line shows 32M try 64M: memory_limit = 64M ; Maximum amount of memory a script may consume (64MB)

  2. If you don't have access to PHP.ini try adding this to an .htaccess file: php_value memory_limit 64M

Sign up to request clarification or add additional context in comments.

1 Comment

I was trying to change web server file and run via CLI. Now edited CLI file and its solved my issue.
5

The simplest way to do this, without the need to change your config is to specify the memory limit when you run the command.

php -dmemory_limit=-1 bin/magento setup:upgrade

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.