Run command in production enviroment

Hi all,

Can You help me please with, how to run the following command in production enviroment, to increase performance

php artisan october:optimize

composer dump-autoload --optimize

Thank you for your help.

Kind regards,
Zsolt

Hi, you have to connect to your production server via SSH and get in your aplication directory and run the commands.

But sometimes if you used the shared hosting, you dont have the ssh access, so you need to call artisan commands with Artisan facade:

public function onOptimize()
    {
      try {
            traceLog('init task...');
            Artisan::call('october:optimize');
            traceLog('done ...');
        } catch (Exception $e) {
            Response::make($e->getMessage(), 500);
        }
    }

But I dont know if it works → I’ve get it here: calling a command from a button in the backend ? - October CMS