phplaravelnginxlaravel-5file-permissions

Laravel: file_put_contents() permission denied — correct storage/framework/cache permissions?


I'm having struggles with editing the Laravel cache, which is located in storage/framework/cache. I've got a job running that saves to a certain cache, but every time the job runs, this error occurs:

ERROR: file_put_contents(/var/www/html/---/storage/framework/cache/data/3c/c7/3cc7fd54b5a3cb08ceb0754f58371cec1196159a): failed to open stream: Permission denied

Details

Any help is appreciated! Thank you in advance.


Solution

  • I cleared the cache completely using sudo php artisan cache:clear. Afterwards, the problem never occurred.

    Opposed to Ismoil's answer: never make the Laravel storage folder 777. It poses a security risk.