skcin7
8 months ago

How does the /storage directory permissions keep getting set back to 755?

Posted 8 months ago by skcin7

Hi. I've been using Laravel for a long time and LOVE it. Right now I'm building a simple Laravel app to keep track of my personal expenses. It's awesome!

Anyway, can somebody please explain to me how the permissions of the /storage directory keeps getting reset back to 755? I think it's something to do with composer.json but I'm inspecting my composer.json and it's not immediately clear to me where/how this is happening? Maybe it's somewhere else?

As I'm developing, I notice that the /storage directory permissions seems to often keep getting reset back to 755, which results in an error which looks something like this:

The stream or file "/private/var/www/expenses/storage/logs/laravel-2019-03-19.log" could not be opened: failed to open stream: Permission denied

This is easy enough to fix this simply by doing sudo chmod -R 777 storage to recursively set the /storage directory back to full permissions and then the Laravel app runs again. So I'm not asking how to change the permissions, I'm asking how and where Laravel seems to be constantly resetting the permissions back to 755. I'm finding that I constantly have to set the permissions of this directory back to 777 this as I'm developing, and it's ANNOYING, not to mention drastically slows the productivity of my development flow to constantly have to fix this. Can somebody please explain to me where/how this directory seems to keep getting reset to 755? It would help me a lot just to understand better what's happening here. Thank you in advance.

PS: Also, for the record, I only want the permissions of /storage be 777 on my development machine. Permissions of this directory on production is 755 and it seems to be working fine there. I would not make the permissions be 777 on a production machine.

Please sign in or create an account to participate in this conversation.