Laravel storage issue while pushing to production server - laravel-5

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

Related

Unable to configure Laravel storage symlink

Tired of searching :-(
Configuration:
AWS (Instance)
Ubuntu 14.04.6 LTS
Laravel 5.8
Project root -> Permission and ownership
Inside project root
php artisan storage:link
project/public
Browser console says:
The complete project is working fine, even I am able to upload as follows.
$request->file('picture')->store('profile_pictures', 'public')
You might want to try this.
cd /var/www/html/yourproject
chmod -R 755 storage
chown -R www-data:www-data storage
Thanks.

How to solve the problem of accessing the storage in Laravel folder

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

Laravel project folder permission

I have a problem with my Laravel project on VPS. Locally everything works fine, but on VPS sometimes folder permission changes and web site stops to work. I don't know what causes this problem and what should I do?
Every time I have to fix with this code:
sudo chown -R user:user /data/web/website.com
There may be some script which is rewriting the permissions for your folder. Go with the .htaccess file that will definately work.

Laravel 5.4 have Blank Page - No Error Display, No Error Log

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.

Laravel 5.3 Cannot Find File Error

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

Resources