I tried activating production mode, However i got an error saying exec is disabled. So i activated the production mode by using php bin/magento deploy:mode:set production -s. Then when i tried to access the site, i got exception printing error. So i reversed to default mode and everything works fine. Could you please tell me what might be the error ? i need to set my site to production mode ASAP.

  • Check the report log under var/report for production mode. Something maybe generated or static content directory permission issue – Sohel Rana Jun 27 '20 at 17:15

It seems your hosting provider has disabled php exec(). You need to ask your hosting provider to enable it.

Basically the error is coming from Shell.php file residing in /lib/internal/Magento/Framework. See the code below

$disabled = explode(',', ini_get('disable_functions'));
if (in_array('exec', $disabled)) {
    throw new Exception("exec function is disabled.");
exec($command, $output, $exitCode);

Ref: https://magento.stackexchange.com/a/134257/77673

Hope it helped you


  • Thank you for your help, But i have read that most hosting providers don't enable php exec as it has security risks. Is there any other way i can enable production mode without breaking my site ? – Faaz Muhammed Jun 27 '20 at 14:34
  • I understand but I am worried if there is any other way. There is one manual and cumbersome process I found but not suitable for constant updates. Link : community.magento.com/t5/Magento-2-x-Technical-Issues/… – Abdul Pathan Jun 27 '20 at 14:48
  • Thanks for your help, I have read, ill talk to my hosting providers first and let you know. Btw is switching to production mode a must ? – Faaz Muhammed Jun 27 '20 at 14:56
  • Switching to production mode will give you faster access speed since it generates the caches. It will increase the speed of your site by immense difference. So its preferred to keep all live sites in production mode. – Abdul Pathan Jun 27 '20 at 14:59
  • Dear, My hosting providers sorted it out. Thank you very much for the support. – Faaz Muhammed Jun 27 '20 at 19:14

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.