laravel-bridge icon indicating copy to clipboard operation
laravel-bridge copied to clipboard

Create storage directories as 777

Open georgeboot opened this issue 2 years ago • 5 comments
trafficstars

Create storage dirs with 777 permissions, so that php-fpm can access the directory (it runs as user nobody).

Fixes #117

georgeboot avatar May 05 '23 17:05 georgeboot

Could be my specific use-case or environment, but might be worth noting that I ran into this problem as well but the above didn't work due to the default umask of the root user, which drops the applied permission back down to 0755.

Clearing the umask temporarily with umask(0) (and then putting it back) resolves this for me.

I'm not going to pretend I already knew this and didn't spend a morning smacking my head into the wall! https://stackoverflow.com/a/3997671

mattrenner avatar May 06 '23 07:05 mattrenner

@mattrenner whole TIL about umask, thanks for sharing.

I'm 👍 to merge this, I don't think it hurts anything (PHP should have access to write this directory, and there shouldn't be any other user, so I don't see a security issue), but maybe we should change off and on the umask too then?

mnapoli avatar May 09 '23 08:05 mnapoli

Stumbled upon the same issue, only locally though: Just changing the permissions to 0777 did not work, changing and resetting the umask did the trick!

FRoepstorf avatar May 22 '23 14:05 FRoepstorf

The way I handle this sort of issue is to configure my local container to run with the nobody user, which matches the FPM configration that Bref ships. With docker compose it's as easy as setting your container with user: nobody.

deleugpn avatar Jul 02 '23 00:07 deleugpn

@deleugpn do you see a way for us to fix this for all users? Would it make sense to change the user in Docker images for example, or could that mess things up? I haven't taken the time to dig into this.

mnapoli avatar Jul 02 '23 14:07 mnapoli