cancel
Showing results for 
Search instead for 
Did you mean: 

exec function is disabled: Production Mode problem

exec function is disabled: Production Mode problem

Hello,

I have my site on Magento 2.1.11

I ran command php bin/magento deploy:mode:set production to set my site in Production mode.

It throws following error

"exec function is disabled."

When I talked to my hosting provider, they say that the exec function is disabled for security reasons. I have to search for an alternative.

Is there any alternative for this or any other suggestion ?

Thanks

 

3 REPLIES

Re: exec function is disabled: Production Mode problem

The error is coming from Shell.php file of Magento 2.

 

Where they written Below code

 

 

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


So looking at the file , EXEC  must needs to enabled from php.ini file.

 

 

Only the option is ask hosting provider to re-enabled exec function because its must required.

 

Refer this link as wellhttps://magento.stackexchange.com/questions/134249/while-running-cron-through-command-prompt-getting...

 

 

if issue solved,Click Kudos & Accept as Solution

Re: exec function is disabled: Production Mode problem

Thanks for reply.

My hosting provider denied to enable exec function for security reasons. So, I decided to opt another alternative.

I installed Wamp server at my PC.

Then, I imported my whole site with database to Wamp server.

There, I made necessary changes and changed the mode to Production with no problem at all.

After that, I exported my site again to web server.

Now, everything is OK and I have checked the mode by command php bin/magento deploy:mode:show and it shows production mode.

Problem solved.

Re: exec function is disabled: Production Mode problem

Yes , Thats the manual alternate process , so now every time if you need to change anything you need to do it first in your wamp server (local) and then move it on server.

 

But alternative of exec function on server , is near to impossible so that i have shared my thoughts for the same.

 

Anyways happy to know that you have solved your issue.

if issue solved,Click Kudos & Accept as Solution