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.
1 Answer
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
Thanks
-
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 ? Commented Jun 27, 2020 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/… Commented Jun 27, 2020 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 ? Commented Jun 27, 2020 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. Commented Jun 27, 2020 at 14:59
-
Dear, My hosting providers sorted it out. Thank you very much for the support. Commented Jun 27, 2020 at 19:14