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

sanjum's avatar

Why are some directories under storage/framework/cache/data being created by the root user?

I’ve investigated and found that some cache directories are being created by the root user instead of www-data. Do you think the configuration below is causing the issue?

  [supervisord]
  nodaemon = true
  user = root

  [program:laravel-worker]
  process_name = %(program_name)s_%(process_num)02d
  command = php /www/artisan queue:work --max-time=3600
  autostart = true
  autorestart = true
  stopasgroup = true
  killasgroup = true
  user = root
  numprocs = 8
  redirect_stderr = true
  stdout_logfile = /laravel_worker.log
0 likes
3 replies
Glukinho's avatar

Yes, this is because of queue worker. You should set appropriate user/group in supervisord if that bothers you.

1 like
Snapey's avatar

this will be a big issue if your web server is running as www-data (for example), causing crashes when the web user tries to create cache folders with the same prefix.

1 like
sanjum's avatar

@glukinho @snapey Thanks for your answers. Yes, my server is running as www-data, and I believe that setting the laravel-worker user to www-data will resolve this issue.

  [supervisord]
  nodaemon = true
  user = root

  [program:laravel-worker]
  process_name = %(program_name)s_%(process_num)02d
  command = php /www/artisan queue:work --max-time=3600
  autostart = true
  autorestart = true
  stopasgroup = true
  killasgroup = true
  user = www-data
  numprocs = 8
  redirect_stderr = true
  stdout_logfile = /laravel_worker.log

Please or to participate in this conversation.