1

I have a laravel website setup and running on a Debian 10 server with PHP-FPM 7.3 and also Nginx

The fpm user in the config is www-data the nginx user in nginx.conf is also www-data

I have set permissions on storage like chmod -R 777 ./storage and chown'd with chown -R www-data:www-data ./storage

When I monitor the logs Im seeing sessions being written as root and only root perms and the logs reporting this issue a lot

[2020-04-29 18:57:57] production.ERROR: file_put_contents(/var/www/html/storage/framework/sessions/FxzelAW8uGvV4mTUDJXo8aHCE56xjKHS5L7y2xsn): failed to open stream: Permission denied {"exception":"[object] (ErrorException(code: 0): file_put_contents(/var/www/html/storage/framework/sessions/FxzelAW8uGvV4mTUDJXo8aHCE56xjKHS5L7y2xsn): failed to open stream: Permission denied at /var/www/html/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122)

doing ls -la on the storage dir yields the following:

drwxrwxrwx 3 www-data www-data  4096 Apr 24 13:26 app
drwxrwxrwx 2 www-data www-data 32768 Apr 25 09:08 debugbar
drwxrwxrwx 6 www-data www-data  4096 Apr 24 13:26 framework
drwxrwxrwx 2 www-data www-data  4096 Apr 29 00:01 logs
Kravitz
  • 2,769
  • 6
  • 26
  • 53
  • Can you do a `ls -l /path/to/storage` and add the result here? Alternatively you can try [this answer](https://stackoverflow.com/questions/30639174/how-to-set-up-file-permissions-for-laravel). – Andrei Apr 29 '20 at 18:18
  • @Andrei sure i updated with the results now – Kravitz Apr 29 '20 at 19:43

1 Answers1

1

This is work for me.

sudo chmod -Rvc 775 storage

General Grievance
  • 4,555
  • 31
  • 31
  • 45
Geovane Krüger
  • 1,071
  • 1
  • 8
  • 10