skip to Main Content

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

Answers


  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

    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

    Login or Signup to reply.
  2. 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
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search