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

  • 2
    Try to add "-vvv" key to your console command. It should give you more details about the error.
    – Amasty
    Commented Jun 17, 2016 at 9:14
  • @Aus-tn did you find a resolution? I'm with siteground cloud and encounter the same issue. Commented Oct 22, 2019 at 23:56

2 Answers 2


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.


I resolved this issue by using these commands.

Run this commands

  1. sudo php bin/magento maintenance:disable
  2. clear cache
  3. sudo chmod 777 var* -R
  4. sudo chmod 777 pub* -R
  • 3
    Setting anything to 777 is never the answer
    – Mageician
    Commented Jun 30, 2020 at 17:36
  • @Mageician, thats not true. if you are running it just for you on a VM then it does not mather at all. But never do this on shared hosting.
    – Black
    Commented Mar 23, 2022 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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