Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

playing_life's avatar

Laravel Workers with Supervisord not processing jobs

I have a container built from image thecodingmachine/php:8.1-v4-slim-apache. I have setup supervisor like so:

supervisord.conf
[unix_http_server]
file=/var/run/supervisor.sock
chmod=0700

[supervisord]
logfile=/var/log/supervisor/supervisord.log
pidfile=/var/run/supervisord.pid
childlogdir=/var/log/supervisor
directory=/var/www/html

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///var/run/supervisor.sock

[include]
files = /etc/supervisor/conf.d/*.conf

and a worker that I want to start

worker.conf
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php artisan queue:work
startsecs = 0
autostart=true
autorestart=true
user=docker
numprocs=3
redirect_stderr=true
stdout_logfile=/var/log/supervisor/laravel-worker.log
stopwaitsecs=3600
directory=/var/www/html

[eventlistener:email_on_process_stop]
process_name=%(program_name)s_%(process_num)02d
command=/usr/bin/php /var/www/html/docker/scripts/emailOnProcessStop.php
events=PROCESS_STATE_STARTING,PROCESS_STATE_RUNNING,PROCESS_STATE_STOPPED
buffer_size=10
numprocs=2
user=docker
autostart=true
autorestart=unexpected
directory=/var/www/html

#directory=/var/www/html/docker/scripts
#stderr_logfile=/var/www/html/docker/scripts/emailOnProcessStop_err.log

When I start the wroker with supervisor, the command "php artisan queue:work" is there in the processes list but no job is processed. I logged in into the container and if I run the command manually jobs are processed correctly. But, if I run "sudo su docker" OR "su docker" (I'm switching to the same current user) first and then run the command, again no jobs are processed. It looks like if I'm sudo-ing or switching users, even to the same user, the worker does not see the jobs or something. On my local development it works to process jobs sudo-ing or switching users, but on the production server it does not.

Maybe someone has encountered this situation or has any ideea. Thank you

0 likes
7 replies
hupp's avatar

@playing_life File Permissions: Verify that the user running the Supervisor process has appropriate permissions to read/write to the necessary files and directories. For Laravel, the storage and bootstrap/cache directories need to be writable by the web server user. Also try with Restart the sudo supervisorctl restart all

hupp's avatar

@playing_life also check stdout_logfile=/var/log/supervisor/laravel-worker.log file for more log detail

hupp's avatar

@playing_life Hope you using this one. Start Supervisor inside the container

docker exec -it your-laravel-container supervisord -n
playing_life's avatar

@hupp I have set 777 to all files in the /var/www/html folder. Still same issue. I have also tried to start the command "php artisan queue:work" from a cronjob, without even installing supervisor. I get the same result, Worker is running but no jobs are being processed.

joeltf's avatar

If you are using a queue with a database, the error that it runs but does not process the queues may be due to a database connection error, Laravel tries to connect to the database but cannot

Please or to participate in this conversation.