Support the ongoing development of →
Configuration Testing
Last updated 7 months ago.

Howdy! file_put_contents() permission_denied, is normally a lack of file permissions (only obvious to some). If you have access to that applications root folder via terminal, you can use this (very crude) command (actually several in one):

echo “Fixing folder permissions…” && sudo find . -type d -exec chmod 0755 {} \; && echo “Successfully fixed folder permissions \n Fixing file permissions.” && sudo find . -type f -exec chmod 0644 {} \; && echo “Successfully fixed file permissions. \n Fixing storage permissions…” && sudo chmod -R 777 storage && echo “Successfully fixed permissions \n Clearing application cache to register new permissions…” && php artisan cache:clear

This command sets the permissions correctly for a laravel application. Changing folders to 755, files to 644, and the storage folder to 777. It then clears the cache just for good measure, to make sure it loads new files. I would recommend trying this first on a website that isn't live, but I've had no problems with it so far!

Last updated 6 years ago.

Thanks for the quick response but it's not a permissions issue, it's a file not found issue. I actually changed the permissions to 777 just to try it and I still get the same error. I'm pretty certain at this point that permissions don't have anything to do with my problem.


Ahh I'm sorry. I skipped a step. When I come across this problem, I normally have to run 'composer install' on that project, because composer install is what will install the necessary files that it is trying to reach. Sometimes composer installs with the wrong permissions, which requires me to run the one I gave you to fix the permissions.


Sign in to participate in this thread!


Your banner here too?

bpfruin bpfruin Joined 16 May 2016


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 - All rights reserved.