Magento – Magento 2: Can’t switch from developer to production: “Command returned non-zero exit code:”

deploydeveloper-modemagento2

I've seen two other threads with this issue but I have been unable to resolve it with the solutions provided.

I've increased my memory limit to 1G in php.ini and I've set ini_set('memory_limit','2G'); right under my <?php tag in bin/magento.

In PuTTY I run;
/usr/local/php56/bin/php-cli /home/lfcstage/public_html/bin/magento deploy:mode:set production
which returns;
Command returned non-zero exit code:
php -f /home/lfcstage/public_html/bin/magento setup:static-content:deploy en_US 2>&1

However, when I run;

/usr/local/php56/bin/php-cli /home/lfcstage/public_html/bin/magento deploy:mode:set production

it completes successfully so I don't understand why I still can't toggle my mode back to production from developer.

I'm hosted on a cloud solution with SiteGround.
Specs: 1 x 3.0 GHz CPU Cores, CentOS, 2GB RAM, 20GB SSD, cPanel, Cloud Storage, Management Services

Best Answer

Turns out Magento was not able to compile on my SiteGround build. I could switch it back when I ran;

/usr/local/php56/bin/php-cli bin/magento deploy:mode:set production --skip-compilation

Stay away from SiteGround with Magento 2 IMO, clean installs of Magento 2 just do not work.

Related Topic