We have a Laravel app (version 4) that we're trying to deploy on AWS. Previously, it was hosted in our local servers via XAMPP. On AWS, I created a folder for the laravel app in var/www/html directory path. But as I try to access http://aws-url/laravel_folder/public, I get the error message:
Error in exception handler: The stream or file "/var/www/html/laravel_folder/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/html/laravel_folder/bootstrap/compiled.php:9134
I've checkout all similar questions and have followed the suggestions, i.e. setting permission of laravel.log to 777, but still keep getting the same problem.
How do I fix this problem?
Thank you
First 777 permission is not a good idea.
If you're on linux, use the following command:
chmod -R 770 logs (add sudo in front if you're not the owner of the folder!)
That will give owner and group read-write-execute permission on the logs folder and everything inside it but will give no permission to other users.
Also make sure that the folder and files inside it have the web server's user as group.
Hope that's help!
You need to set the permissions for the entire storage folder to 777
sudo chmod -R 777 storage/
Related
I am trying to upload my laravel project from Xampp to shared hosting, but I get the error:
file_put_contents(C:\xampp\htdocs\resido\storage\framework/sessions/Jmmr9HI35UYdhIfZLDTVlLGjCy5AHiuVK9NfOQuT): failed to open stream: No such file or directory
when I try either of the following solutions:
delete the file app/bootstrap/cache/config.php
composer dump-autoload
php artisan config:clear,
the application works. however, all the changes I made while working with xampp is gone and I get the old view from the application template.
how do I fix this problem without losing the changes I made to the project?
I think I'm having this error because the folder C:\xampp\htdocs\resido\storage\framework/sessions does not exist
how do I change this directory to that of the live hosting?
Make sure the which you are calling is available in the "storage\framework/sessions" folder
OR you can unset all the current sessions from the browser and try
It is quietly often when we try to move our code to the server by copy paste the whole project.
To solve this problem you need to check inside storage/framework/sessions.
Is there a sessions folder available or not, if not then create it manually on the server and give the permission of 664 or 775 to the storage directory recursively.
For permission, you can use this command from server cmd inside the project directory :
sudo chmod -R 775 storage and sudo chmod -R 775 storage/*.
I have deployed laravel app on a cpanel but I get this error when I try to access the app
The stream or file "/home2/../public_html/../../storage/logs/laravel.log" could not be opened: failed to open stream: Read-only file system.
Am unable to set the file permission on the cpanel.
Please does any one have a way I can go around this ? Thanks
You need to grant read access to storage folder.
chmod -R 775 storage
you can use this command,
its work for me!
sudo chmod -R ugo+rw storage
it gives me this error when i put laravel on apache server
The stream or file "/var/www/app/storage/logs/laravel-2019-01-02.log" could not be opened: failed to open stream: Permission denied
i have tried everything i set permission to 777 and set owner to root and i try permission 775 also didnot work can any one help me with this...?
note: i am working on apache server on CentOS7
It's a permission issue:
Just Open Your CMD -> Go to your project folder -> Run the following command:
sudo chmod 777 storage/
i fix it...
after using this command i still didnot know what is the reason
1.cd /var/www/html
2.setenforce 0
3.service httpd restart
I've got an error in a Laravel instance, which says:
[2016-11-08 16:48:19] prod.ERROR: ErrorException:
file_put_contents(/theLaravelSite/bootstrap/cache/services.php):
failed to open stream: Permission denied in
/theLaravelSite/bootstrap/cache/compiled.php:7327
I've seen these errors before, which relate to the storage folder, but I'm a bit confused by this one, since it seems to say that it tries to write content to bootstrap/cache/services.php.
Any idea how I can solve this?
Change the directory permissions to:
chmod -R 775 storage/
chmod -R 775 bootstrap/cache/
According to Laravel Docs
After installing Laravel, you may need to configure some permissions. Directories within the storage and the bootstrap/cache directories should be writable by your web server or Laravel will not run. If you are using the Homestead virtual machine, these permissions should already be set.
You should set correct permissions on bootstrap folder recursively:
chmod -R 775 bootstrap
Also, check if bootstrap/cache exists. If it doesn't exist, create it manually.
I get this error while trying to do file_put_contents().
Apache is working as apache group, started with sudo rights. My user is in apache group. All dirs and files have 755 chmod.
File exists.
Locally it works fine, on remote CentOS server not. Why? How to debug that thing?
Sometimes SELINUX will prevent writing as was my problem serving from Fedora. Run:
sudo setenforce 0
This can be solved by changing directory permission.
Run the command like
chmod 777 database (the directory)
You can use getcwd()" to find the directory path.
Please have a look here