Back

Class Not Found Calling a Laravel Script from Supervisord


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

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.

fifothekid replied 6 months ago Solution

I could solve it by specifying the exact path of the php binary I still don't understand why it didn't pick the default one


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us