Console Command called from the web dies early

Posted 2 years ago by TonsOfLaz

Hi, I have a console command that takes about 20 minutes to run. It needs to be kicked off by an admin from the web, so I call it like so:

Route::post('send-email', function() {
            $exitCode = Artisan::call('myapp:send');

In my Console Command, I have added these lines to the top:

ini_set('max_execution_time', 5000);
ini_set('memory_limit', '100M');

class SendMyAppEmail extends Command

But it never gets beyond about a minute or so. If I run it directly from the console, it completes with no problems.

Does anyone know why this process would crash when kicked off from the web interface but not the console? Is there a good way in Laravel to run this command in the background the same as if it was run from the console?

Thank you very much for your time.

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.