1

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.

  • 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. – Himmat Paliwal Dec 18 '18 at 11:16
  • Already set ini_set('memory_limit', '-1'); in index.php but not working – Jugal Kishor Dec 18 '18 at 11:18
  • Do You have other solution? – Jugal Kishor Dec 18 '18 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? – Himmat Paliwal Dec 18 '18 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/… – Rinto George Dec 18 '18 at 12:03
3

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.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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