I’m deploying a Laravel app on CentOS. I’ve following the following steps:
- Cloned my repo
- Installed composer
- Setup config
Now I’m getting the following error message when I open my website:
file_put_contents(/var/www/portal/storage/framework/sessions/IDElrNpsn0hu9hjiXAzZRUTHyzm2fqvPHSLy0ZVN): failed to open stream: Permission denied
On ubuntu I used the following command to resolve the issue:
sudo chown -R $USER:www-data storage
sudo chown -R $USER:www-data bootstrap/cache
chmod -R 775 storage
chmod -R 775 bootstrap/cache
Now on CentOS above 2 commands are not working and I’m getting ErrorException.
Can anyone tell me which command should I run in CentOS 7 to resolve this error?
Thanks
2
Answers
The issue is resolved. The solutions for centOS is to use apache instead of www-data.
this was the only solution for me!! After 3 days and nothing to do whit permisions, chmod chown… it was the ffffff server!!
semanage fcontext -a -t httpd_sys_rw_content_t ‘/var/www/bagisto/bootstrap/cache(/.)?’
semanage fcontext -a -t httpd_sys_rw_content_t ‘/var/www/bagisto/storage(/.)?’
restorecon -Rv ‘/var/www/bagisto’
see more here!
https://laracasts.com/discuss/channels/general-discussion/file-put-contents-2