Kobid Kunda
Kobid Kunda

Reputation: 47

While running PHP bin/magento deploy:mode:set production I am getting error on magento 2.1

I am using php7 with nginx

Something went wrong while compiling generated code. See the error log for details.

Command returned non-zero exit code: /usr/bin/php7.0 -f /var/www/magento2/bin/magento setup:di:compile

Upvotes: 0

Views: 2657

Answers (2)

Toan Nguyen
Toan Nguyen

Reputation: 936

Command returned non-zero exit code: /usr/bin/php7.0 -f /var/www/magento2/bin/magento setup:di:compile

In Magento 2 world, this error message is widely-known as memory limit problem. That is why in Magento 2 requirement, they recommend us to set

memory_limit = 768M

That is the perfect size to run Magento 2 commands in almost situation.

Upvotes: 0

David Verholen
David Verholen

Reputation: 111

try to run the failing command with the -vvv switch (for very verbose output).

/usr/bin/php7.0 -f /var/www/magento2/bin/magento setup:di:compile -vvv

with this command you should at least get a better error message than "an error occurred..."

very likely, it's just the memory_limit being too low. You can increase the memory limit for a php process by adding the -d parameter to the php command:

/usr/bin/php7.0 -d memory_limit=1G -f /var/www/magento2/bin/magento setup:di:compile

if you run deploy:mode:set production, the compilation will be startet as a sub process and you can't increase the memory limit like this (since the parameter is not passed to the sub command)

in this case, you have to increase the memory limit in your php configuration

Upvotes: 1

Related Questions