Q: Configure default permission for Laravel `storage` directory for _newly_ created files How do I configure Laravel such that newly created files and directories below ./storage become group writable?
The Laravel ./storage directory contains files which are dynamically generated during runtime of the application. For example, ./storage/framework/views contains compiled and cached versions of the Laravel Blade templates. The webserver runs as user and group apache:apache. Upon every upgrade of the application, I need to run the console command ./artisan optimize:clear to remove outdated, cached files. The admin user is also a member of the group apache, e.g. lets assume the account is my_user:apache.
Unfortunately, Laravel creates new files with permission 0640 and directories with permission 0750, i.e. they are only group-readable, but not group-writable. This means running ./artisan optimize:clear as my_user fails because group membership is not sufficient.
