114

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.

Amin Shojaei
  • 5,451
  • 2
  • 38
  • 46
Timothée
  • 1,229
  • 3
  • 9
  • 6
  • 4
    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! – Nelson Apr 10 '20 at 21:16
  • 3
    php artisan dump-autoload? you might mean 'composer dump-autoload' – steve sonius May 25 '20 at 00:12
  • In my case, I just forgot a `;` in a file... so check if you don't have errors in any files. – Madriesen Oct 21 '21 at 12:27

16 Answers16

246

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

Novocaine
  • 4,692
  • 4
  • 44
  • 66
frankfurt-laravel
  • 3,731
  • 2
  • 20
  • 29
  • 2
    This sequence (route, config, then cache) worked for me! – Ihab Shoully May 10 '20 at 02:00
  • 1
    For last command: Failed to clear cache. Make sure you have the appropriate permissions. – Chanchal Raj Jun 18 '20 at 13:53
  • 3
    Chanchal: Here you go https://stackoverflow.com/questions/52231248/laravel-showing-failed-to-clear-cache-make-sure-you-have-the-appropriate-permi Was a one sec search. – frankfurt-laravel Jun 18 '20 at 17:34
  • 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... – Canelo Digital Jul 02 '20 at 19:48
  • Only Jesus know why this is related with `Redis error: cannot assign requested address ` but now is fixed. – insign May 11 '21 at 05:34
  • If this problem persists while running Laravel locally inside a Docker container, make sure you execute these commands inside the container. – qotsa42 Jan 26 '22 at 18:18
133

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.
Chris Forrence
  • 10,042
  • 11
  • 48
  • 64
Aditya Chauhan
  • 1,331
  • 1
  • 6
  • 2
63

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
TarangP
  • 2,711
  • 5
  • 20
  • 41
Vikas Rinvi
  • 1,158
  • 12
  • 28
29

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.

Sølve T.
  • 4,159
  • 1
  • 20
  • 31
dijux
  • 541
  • 5
  • 8
5

go to your vagrant

then run

vagrant ssh

php artisan config:cache

Farid shahidi
  • 318
  • 4
  • 9
  • Could you give a little more detail on what this accomplishes – PilouPili Sep 09 '18 at 12:11
  • 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. – Farid shahidi Dec 06 '20 at 08:25
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

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
jrran90
  • 668
  • 12
  • 18
2

This one-line command solves my issue:

php artisan config:cache
linktoahref
  • 7,812
  • 3
  • 29
  • 51
Felix Labayen
  • 385
  • 3
  • 8
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
    
β.εηοιτ.βε
  • 33,893
  • 13
  • 69
  • 83
neel
  • 111
  • 3
1

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

r3n4y
  • 77
  • 3
1

For those of you using sail, do:

sail artisan optimize:clear
Ulrik McArdle
  • 601
  • 4
  • 9
0

Please run the below commands:

php artisan route:clear
php artisan config:clear
php artisan cache:clear
ETO
  • 6,970
  • 1
  • 20
  • 37
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

Tony Okoth
  • 157
  • 1
  • 4
0

You need to run this command from the terminal.

php artisan config:clear
php artisan config:cache
Jigar
  • 3,055
  • 1
  • 32
  • 51
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.

Buddhika
  • 163
  • 1
  • 7
  • 1
    Using `777` permission is a REALLY bad permission and it has so many security issues because it give `RWX` permission to every body! – Farbod Ahmadian Jun 16 '20 at 19:41
  • 1
    @FarbodAhmadian thanks, I change my permissions to 755 also work for me. I edit my above answer also after your comment. – Buddhika Jun 17 '20 at 02:20
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
jizhihaoSAMA
  • 12,336
  • 9
  • 27
  • 49