Reputation: 1158
The error is mention in below:-
ErrorException in Filesystem.php line 81:
file_put_contents(/var/www/html/Training-management-system/storage/framework/views/bcb68ba8b65b7fabca5fe88709fb00b6): failed to open stream: Permission denied
I can google itbut not get the exact solution. SO I am thankful if anyone help me to solve it out.
Upvotes: 16
Views: 66712
Reputation: 619
Never use 777, use 644 for files, and 755 for dirs.
export APACHE_USER=$(ps -ef | grep -E '(httpd|apache2|apache)' | grep -v `whoami` | grep -v root | head -n1 | awk '{print $1}')
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chgrp -R $APACHE_USER ./storage ./bootstrap/cache
chmod -R ug+rw ./bootstrap/cache ./storage/framework/cache storage/framework/sessions ./storage/framework/views
If you use SELinux set labels:
restorecon -Rv .
chcon -R -t httpd_log_t storage/logs
chcon -R -t httpd_sys_rw_content_t bootstrap/cache
chcon -R -t httpd_sys_rw_content_t storage/framework/cache
chcon -R -t httpd_sys_rw_content_t storage/framework/views
chcon -R -t httpd_sys_rw_content_t storage/framework/sessions
Script ready at: https://gist.github.com/NeftaliYagua/825b6ce483b92a296caa0f37e4ff040a
Upvotes: 1
Reputation: 96
I had the same issue with Laravel running in a docker container. I checked and the www-data group didn't had permissions nor ownership on the directory.
The chown command allows you to change the user and/or group ownership of a given directory.
chown -R www-data:www-data storage/
Keep in mind that chmod -R 777 storage/
permissions is a massive security risk. Normally users outside www-data group should not be able to manipulate files. This is just a workaround for development environments and should be avoided on production environments.
Upvotes: 1
Reputation: 59
This is an error with the view file cache. Please run php artisan view:cache
Upvotes: 1
Reputation: 9373
I tried many solutions but didn't get resolved this error.
Just:
I have just created views folder in 'storage/framework'
and solved it.
Upvotes: 0
Reputation: 876
is a file permissions issue as lesssugar said , you need to give writte permissions to the storage folder , so go to your html/Tranining-management-system.. folder an then you can do :
chmod -R 0777 storage/
That will change to writte access Recursively .
Please read the configuration section in docs :
http://laravel.com/docs/master#configuration
You have to do the same with the cache folder.
Upvotes: 36