I have an envoy script which I am triggering within Laravel Command.
php artisan proxy:update
public function handle() {
exec("envoy run update");
}
If I run this on command line as php artisan proxy:update
, it works.
However if I run this inside my Laravel app as Artisan::call('proxy:configure');
it doesn't work.
In console whoami
= vagrant; likewise in my command exec('whoami')
is also vagrant.
If I change it to
$out = shell_exec('envoy run update');
dd($out);
In command-line it shows the output, but with Artisan::call()
, it returns empty string.
What might be the issue for being able to use exec()
with artisan command?
As far as I understand, php-fpm was blocking it. I tried using Symfony's Process instead of
exec()
and I was getting "terminated". Then I movedArtisan::call()
toArtisan::queue()
and it worked. I'd be happy to know if anyone has any other explanations.Update: I created a queue that is run by
deployer
user which has sudo privileges (normally www-data run my queues). Now it works perfectly.