Laravel showing “Failed to clear cache. Make sure you have the appropriate permissions”

后端 未结 12 2247
逝去的感伤
逝去的感伤 2020-12-10 00:58

Laravel was displaying to me \"Access denied for user \'homestead\'@\'localhost\' (using password: YES)\". One solution for this was clearing the cache and the config cache

相关标签:
12条回答
  • 2020-12-10 01:08

    Just only add folder named data in storage/framework/cache/ and try:

    php artisan cache:clear
    
    0 讨论(0)
  • 2020-12-10 01:09

    maybe you need to chmod 777 -R storage folder. and i think it can also chown www-data:www-data

    0 讨论(0)
  • 2020-12-10 01:10

    If the data directory doesn't exist under (storage/framework/cache/data), then you will have this error.

    This data directory doesn't exist by default on a fresh/new installation.

    Creating the data directory manually at (storage/framework/cache) should fix this issue.

    0 讨论(0)
  • 2020-12-10 01:13

    Try deleting these cached files:

    /bootstrap/cache/packages.php
    /bootstrap/cache/services.php
    /bootstrap/cache/config.php.php
    

    Then run php artisan cache:clear

    0 讨论(0)
  • 2020-12-10 01:15

    You may need to clear the autoloader with composer dump-autoload

    If that doesn't work you can manually remove the following non-tracked (usually) files to clear the autoloader and cache if they get jammed up:

    /bootstrap/cache/packages.php

    /bootstrap/cache/services.php

    0 讨论(0)
  • 2020-12-10 01:25

    I had the same problem but noticed if you run php artisan config:clear it also by default runs cache:clear right after it so when you run it again there is not cache in it and gives that error. you only need to run php artisan config:clear. I am not sure why cache:clear fails when its ran alone but running the config:clear is a good alternative.

    Here is a helpful alias i use to clear everything in the app.

    laraclear='php artisan config:cache && php artisan config:clear && php artisan view:clear && php artisan route:clear && php artisan telescope:clear && php artisan debugbar:clear'
    

    Remove any unwanted commands that you do not use in it.

    0 讨论(0)
提交回复
热议问题