I'm using Laravel workers to execute some background tasks. When I invoke the worker using 'php artisan queue:work', it works without any problem
But when I add the same command to supervisord in CentOS, using the following congifuration:
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d command=php
/var/www/html/laravel/artisan queue:work
autostart=true
autorestart=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/html/laravel/worker.log
I get the following error:
PHP Fatal error: Class 'SoapClient' not found in /var/www/html/laravel/app/External/library/RegistrationService.php on line 169
[Symfony\Component\Debug\Exception\FatalErrorException] Class 'SoapClient' not found
The jobs are not executed complaining that SoapClient is not found (although it is installed). The SoapClient class is inherited by a plain PHP class that I load externally.
Note that I can use this class via the controller or the jobs when executed from command line without any problem, only in supervisord it's giving me the error message. To make things more weird, it happens only with one job that utilizes this external class, it doesn't happen with jobs that utilize Laravel's classes (controllers, events, etc...) only.