When compiling Magento 2, I'm getting the error:

Fatal error: Out of memory (allocated 294125568) (tried to allocate 32 bytes) in /vendor/zendframework/zend-code/src/Scanner/FileScanner.php on line 36

I've read a ton of answers to this question, and everyone suggests using -dmemory_limit to increase memory while compiling. I've tried 756M, 4G, 5G, 8G, 16G, etc and it still doesn't work.

Any ideas?

  • check to the php info for your memory_limit value – Abhishek Tripathi Apr 25 '19 at 3:53

Try increasing the memory_limit in php.ini

In Your /etc/php/7.0/apache2/php.ini or find your loaded ini file by creating info.php file and look for Loaded Configuration File.

Find memory_limit in php.ini file and increase memory limit to

memory_limit = 2G

Your Answer

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

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