3

I have getting this error in magento 2.

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 28672 bytes) in

/home/www/public_html/website.com/vendor/composer/composer/src/Composer/Package/Dumper/ArrayDumper.php

on line 89

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 425984 bytes) in

/home/www/public_html/website.com/vendor/composer/composer/src/Composer/Json/JsonFile.php

on line 93

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 425984 bytes) in

/home/www/public_html/website.com/vendor/composer/composer/src/Composer/Json/JsonFile.php on line 93

Please help me to solve this issue. thanks in advance.

5
  • Seems memory limit issue, set it in php.ini or via php if it works. You can add code ini_set('memory_limit', -1); to your root index.php file to set required memory allocated. If it doesn't work then you need to contact server support to get memory limit updated. Dec 18, 2018 at 11:16
  • Already set ini_set('memory_limit', '-1'); in index.php but not working Dec 18, 2018 at 11:18
  • Do You have other solution? Dec 18, 2018 at 11:20
  • No, If you are still getting Allowed memory size issue then it is not being affected by your code added in index.php. Can you confirm the same by putting phpinfo.php to your setup? Dec 18, 2018 at 11:24
  • From the error it seems that you have below 256MB memory, for a smooth run of Magento 2, you will have to assign at least 2GB Memory. devdocs.magento.com/guides/v2.0/install-gde/…
    – Duke
    Dec 18, 2018 at 12:03

1 Answer 1

4

I was facing the same issue but was able to resolve.

  • Php path which cron was using was incorrect, hence absolute path should be used.
  • Memory limit for PHP-CLI and PHP was different, so passed the params to override in CLI.
  • Example:

    
    */5 * * * * /opt/lampp/bin/php -d memory_limit=2G /opt/lampp/htdocs/magento/enterprise/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /opt/lampp/htdocs/magento/enterprise/var/log/magento.cron.log
    
    */5 * * * * /opt/lampp/bin/php -d memory_limit=2G /opt/lampp/htdocs/magento/enterprise/update/cron.php >> /opt/lampp/htdocs/magento/enterprise/var/log/update.cron.log
    
    */5 * * * * /opt/lampp/bin/php -d memory_limit=2G /opt/lampp/htdocs/magento/enterprise/bin/magento setup:cron:run >> /opt/lampp/htdocs/magento/enterprise/var/log/setup.cron.log
    

/opt/lampp/bin/php : My PHP path.

/opt/lampp/htdocs/magento/enterprise/bin/magento : My Magento CLI path

memory_limit=2G : Memory limit set to 2G, you can update to it as your server limits.

3

Your Answer

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

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