There is no existing directory at /storage/logs and its not buildable: Permission denied
Asked Answered
K

16

117

I have a problem with my Laravel deployment on a OVH web server. After made

composer update

php artisan cache:clear

php artisan route:clear

php artisan dump-autoload

I have this answer:
There is no existing directory at /storage/logs and its not buildable: Permission denied
I put all the files on 777 chmod but I have always this answer.

Kinematograph answered 26/6, 2018 at 10:56 Comment(3)
just as a note to anyone who tries this and it is not used to artisan commands or composer (we all make the same mistake from time to time) the command is composer dump-autoload, not artisan :) cheers!Shank
php artisan dump-autoload? you might mean 'composer dump-autoload'Alla
In my case, I just forgot a ; in a file... so check if you don't have errors in any files.Unbated
E
258

Please try the following commands

php artisan route:clear

php artisan config:clear

php artisan cache:clear

Note: In case you are a Homestead & VirtualBox user, please be sure that your VirtualBox is up to date.

It helped in this thread at laracasts

Earpiercing answered 27/6, 2018 at 14:45 Comment(6)
This sequence (route, config, then cache) worked for me!Knowall
For last command: Failed to clear cache. Make sure you have the appropriate permissions.Locksmith
Chanchal: Here you go #52231748 Was a one sec search.Earpiercing
This works great... in my case it was also the config... But does anyone understand what the underlying problem is? Is it an issue in the configuration? or an error in how the config cache is built (e.g. ignoring .env or something like that?) It seems that folders are there, have the right permissions, etc. so something seems to be smelly, I just can't point at it...Purslane
Only Jesus know why this is related with Redis error: cannot assign requested address but now is fixed.Epitasis
If this problem persists while running Laravel locally inside a Docker container, make sure you execute these commands inside the container.Bowshot
F
138

Clear the cache and config, then deploy to the live server.

If you've already uploaded to the live server, then you have to follow these steps:

  1. Delete bootstrap/cache/config.php
  2. Delete all log files in storage/logs.
Farewell answered 14/12, 2018 at 9:28 Comment(4)
The best answer for shared hosting 👍🏼Preference
I do this and it gets rid of the error stated in the question here, but then I get a 500 Internal Error in its place. Any thoughts?Mvd
Great, thanks! Worked for me with Docker.Adiaphorism
Looks kind of crazy but it actually worked, have been messing with permissions which looked fine for hours. Yet it was not permission issue at all. Thanks much!Kolva
F
73

You don't need to add any permission on the storage file.

  • The main problem here is in the compiled file, and due to which laravel try to show an error.
  • By default in laravel, storage file not having permission to show in the console (error shows from the error.log file).
  • So the thing you need to fix is to fix compile file. which can be done thought this single command

Use this

php artisan optimize:clear

This command will clear all your cache

  • Compiled views
  • Application cache
  • Route cache
  • Configuration cache
Fissile answered 2/4, 2019 at 11:50 Comment(3)
💥 You're a life saver! I had some stupid CORS issue and solved by the command.Schubert
I am happy that it helps. @AmirrezaNasiri Thanks for your comment too.Fissile
Worked, even if it said "Failed to clear cache. Make sure you have the appropriate permissions." :-)Hydrotherapy
A
28

After changing local conf i got the same error over and over, try this, probably will help.

rm bootstrap/cache/config.php

and then

php artisan cache:clear

depending on your scenario, reloading auto-loader file can solve your issue, for that use :

composer dump-autoload

or sometimes just try :

composer install

this do the two the commands listed above.

Ambagious answered 18/12, 2019 at 13:53 Comment(2)
Well this solve the issue. Thank you so much!Stash
just removing the config file and clearing the cache worked for me (no need for composer commands).. thx for the helpServiette
S
5

go to your vagrant

then run

vagrant ssh

php artisan config:cache

Spyglass answered 9/9, 2018 at 11:9 Comment(2)
Could you give a little more detail on what this accomplishesConstrain
First you need to run your vagrant env, then you should connect to its bash script using vagrant ssh, config cache will clear the cached config files, then rebuild them.Spyglass
E
5

Run the following command if you can access your server terminal

php artisan route:clear && php artisan cache:clear && php artisan config:clear && php artisan config:cache

If you are on shared hosting and cant access the terminal go to your web route file in routes/web.php and make a temporary link such as shown:

Route::get('reset', function (){
    Artisan::call('route:clear');
    Artisan::call('cache:clear');
    Artisan::call('config:clear');
    Artisan::call('config:cache');
});

Then go to http://your-domain/reset to execute the commands. there after you can now access your website as normal

Espalier answered 7/2, 2020 at 14:12 Comment(0)
R
3

If you are using homestead (vagrant) in Laravel then follow the steps @Farid shahidi provided

vagrant ssh
cd /home/vagrant/code <-- your file usually resides here; see your Homestead.yaml configuration
php artisan config:cache
Region answered 6/10, 2018 at 17:26 Comment(1)
If you are using vagrant/docker/etc make sure to run php artisan config:cache from inside the machine.Comfortable
U
2

This one-line command solves my issue:

php artisan config:cache
Uncertainty answered 10/5, 2020 at 10:56 Comment(0)
R
2

You Have to try artisan command in this way

  1. php artisan cache: clear
    
  2. php artisan config:cache
    
  3. php artisan cache: clear
    
Regularly answered 29/9, 2020 at 14:13 Comment(1)
Thanks! This helped me a lot!Oleaginous
D
1

Delete bootstrap/cache/config.php from your laravel deployment on the server.

Dobruja answered 17/4, 2020 at 21:8 Comment(1)
simple and working solution thanks alotShiner
P
1

For those of you using sail, do:

sail artisan optimize:clear
Phocomelia answered 8/2, 2023 at 20:22 Comment(0)
A
0

Please run the below commands:

php artisan route:clear
php artisan config:clear
php artisan cache:clear
Archducal answered 22/1, 2019 at 17:22 Comment(0)
E
0

This one worked for me in case your project is located within /var/www/html/

sudo chmod -Rf 0777 /var/www/html/{project-name}/bootstrap/cache sudo chmod -Rf 0777 /var/www/html/{project-name}/storage

Eight answered 5/2, 2019 at 21:47 Comment(0)
O
0

You need to run this command from the terminal.

php artisan config:clear
php artisan config:cache
Onrush answered 15/5, 2019 at 10:2 Comment(0)
T
0

I got the same issue, I change the permissions of the folders inside the the storage folder.

chmod 777 <folder_name>

I'm not sure about this security wise. but this resolve my problem.

I change my file settings to 755 also work for me.

Thersathersites answered 16/6, 2020 at 17:38 Comment(2)
Using 777 permission is a REALLY bad permission and it has so many security issues because it give RWX permission to every body!Bibliopole
@FarbodAhmadian thanks, I change my permissions to 755 also work for me. I edit my above answer also after your comment.Thersathersites
J
0

try this

  1. remove your "vendor" folder
  2. Run "composer install" or "composer install --ignore-platform-reqs" on your cmd or terminal
  3. php artisan config:cache
  4. php artisan config:clear
  5. php artisan cache:clear
  6. php artisan route:cache
  7. php artisan view:clear
  8. php artisan config:cache

if you are using linux:

  1. service apache2 restart (just in case)

if you using xammp:

  1. just restart your xammp
Jonell answered 18/6, 2020 at 7:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.