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

phasee's avatar

DIgitalOcean: laravel.log failed to open stream: permission denied

I've been trying to figure this out for a while now, hoping someone can help.

I have my application hosted in a droplet on Digital Ocean. Set up my linux user for the app, and added said user to the www-data group.

I am using deployer to automatically deploy the application to production. Deployer is set up with a seperate linux user, also added to the www-data group.

When I am using the app, and triggering a job on the queue, the job fails. The logs have this information

[2018-07-07 14:54:46][79] Processing: App\Jobs\SendForgotUIDEmail

In StreamHandler.php line 107:
                                                                               
  The stream or file "/var/www/html/app/releases/8/storage/logs/laravel.l  
  og" could not be opened: failed to open stream: Permission denied  

The permission for the laravel.log (and every file/dir from html down) is

drwxrws---+ 2 www-data www-data   4096   Jul  6 01:30 .
drwxrws---+ 6 www-data www-data   4096   Jul  7 00:23 ..
-rwxrws---+  1  www-data www-data     14       Jul  6 01:27 .gitignore
-rwxrws---+  1  www-data www-data 366078 Jul  7 14:34 laravel.log

I'm wondering if anyone has any ideas that will allow my linux user and the deployer user to work in harmony, i.e. both can read/write/execute without causing errors such as permission denied.

Thanks!

0 likes
3 replies
burlresearch's avatar
  1. Is the system running SeLinux? $ sestatus
  2. Parent directory permissions may impede access ... worth a check.

Otherwise the approach seems reasonable...

phasee's avatar

SeLinux is not running, or installed

Parent directory 'www' is owned by root

phasee's avatar
phasee
OP
Best Answer
Level 2

Restarted the droplet, seemed to fix it

Please or to participate in this conversation.