I've setup a project more than a month ago and all of a sudden (this afternoon) I started getting the following error:
ErrorException in Filesystem.php line 111: file_put_contents(/var/www/html/project/api/storage/framework/cache/d8/00/d800874b5dc22b961e0ee92f8d1c5a09c24ee911): failed to open stream: No such file or directory
I've done research and tried the following with no success:
php artisan cache:clear
chmod -R 777 storage (I know this is not ideal)
composer update
Nothing is working. Before the chmod I was getting a permission error. I'm tapped out of ideas. Does anyone know what is causing this and how to resolve it?
You gave 777 to /storage folder but did you also make sure it's in same group as apache server is running?
Generally apache is in www-data group, add storage and bootstrap folder to be written by this group:
chgrp -R www-data /storage /bootstrap
Assign current user and group permission to read and write:
chmod -R ug+rw /storage /bootstrap
I'm 99% sure this will do it.
My server runs CentOS 7 and somehow Selinux was set to enforcing which breaks Laravel for some reason. I remember changing it when I first set up Laravel, but somehow it reverted back.
So setting it to permissive or disabled fixed it for me.
https://www.centos.org/docs/5/html/5.2/Deployment_Guide/sec-sel-enable-disable.html
Related
Faced a problem accessing the storage folder. A symbolic link was created, but when I try to access any file in the storage folder, I get an error 403 "You do not have permission to access this object. The file is not readable, or the server cannot read it." I have a second project on a local machine, everything works fine there. I tried to give 777 permissions to the storage folder, but this causes the "Permisson denied" error. I will be glad to any help!
Macos catalina
Laravel Permissions
first change ownership of the laravel directory to our web group.
sudo chown -R :www-data /var/www/laravel
Next we need to give the web group write privileges over our storage directory so it can write to this folder.
sudo chmod -R 775 /var/www/laravel/storage
where laravel is the name of the root
I am facing permission denied for storage directory everytime when I push to production even its added in gitignore file like:/storage/*
Also I get "can not create public/storage" error and in this case I delete public/storage and again run php artisan storage:link command.
I tried git -r --cached public/storage command to resolve this issue but not resolved.
can anyone suggest a permanent solution for it? I am getting frustrated doing the same thing again and again. And I know I am doing the small mistake that I could not figure out.
Thanks in advance.
You have to give read/write permission to your folder
Try this to give it the permission
sudo chmod -R 777 storage
i have enabled Laravel debug true and also error in .env and storage folder permission is also 777 and also tried with 0775 but Laravel is not showing cause of 500 error in logs
This error come most of the time because of folder permissions. You need to give permissions 777 recursively to your folders like
sudo chmod 777 laravel/public -R
sudo chmod 777 laravel/storage -R
You can check I hope It will fix the issue, If not then you need to do some more steps in linux. Here is detail: https://rapidsol.blogspot.com/2018/12/how-to-disable-selinux-security.html?q=composer
I Developed one Laravel Project. it has working in local environment properly. But, when i move the project to the server it has no error Shown. I check Error log, it has empty. i enabled APP_DEBUG=true to .env file and config/app.php also.
I give 777 permission for storage Folder. how to find error in my project, anybody help me...
Change storage and logs folder permission to : 0755
and
laravel.log file permission to : 0644
For any folder to be accessible by script, permission should be set to 0755 and for files to 0644 in standard production scenario.
This code works for me chmod -R 777 storage/
I'm using brew. Hope it could help.
I have this website. The problem I have is
The freelancer-ngohungphuc.rhcloud.com page isn’t working
freelancer-ngohungphuc.rhcloud.com is currently unable to handle this
request.
500
I develop this website using Laravel 5.1. So what I have to do to fix this error.
Although you can usually check logs to see why you are getting a 500 error, it would appear that this is due to insufficient permissions - which need to be set on the storage and bootstrap/cache folders (as per the docs).
The folders both need to be writeable by your web server, so whilst 777 permissions will definitely work 775 should be fine (and more secure).
Doing this via a command line can be done with the following command (run it with sudo if you need to elevate to root permissions) chomd 777 -R storage bootstrap/cache or chomd 775 -R storage bootstrap/cache.
Doing this via an FTP client is doable, generally speaking you can just right click on the folder and choosing to edit permissions from there.
In some instances, vendor may need to be done too - from my experiences anyway.
These folders are all inside the root project directory for your Laravel application.
Edit
Excerpt from bottom of error log:
PHP Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE)
This would indicate that the PHP version you are running is not >= 5.5.9 (one of the Laravel requirements).
This is confirmed in the screenshot shown of the OpenShift configuration. The version of PHP needs to be updated for Laravel to work - this wasn't just a permission issue.