Yesterday I tried to install a new module in a Magento 2 app and then I ran the di:compile command via CLI I got the "Fatal error: Out of memory" error. The problem is that after that no matter what command I run the system doesn't even start to run the command, it immediately throws the exact same error. I change the php.ini settings and tried to run the commands using the -dmemory_limit directive but it always returns the same exact error in the same class


 []$ php -dmemory_limit=-1 bin/magento di:compile

Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 65536 bytes) in /**/vendor/zendframework/zend-modulemanager/src/ModuleEvent.php on line 95
  • Where was this command run -> on a local computer / dev server / server in the cloud? – camdixon May 11 '18 at 3:30
  • was in the hosting server – Daniel Vega May 11 '18 at 3:43
  • I edited the question and added an example of what happens when I execute any comand – Daniel Vega May 11 '18 at 3:45
  • what did you change memory_limit to? The Magento 2 recommended setting? Also did you restart PHP afterwards? – camdixon May 11 '18 at 4:03
  • 2
    Try php -dmemory_limit=3G bin/magento setup:di:compile – Vithal Bariya May 11 '18 at 4:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.