Laravel 5 show ErrorException file_put_contents fa

2020-01-30 07:37发布

I have a project on Laravel 5 and I work with it at the office and at home too. It works fine, but recently at home it stopped working. Laravel show me two ErrorException

file_put_contents(G:\project\storage\framework\views/751d8a0fd8a7d4138c09ceb6a34bb377aa2d6265.php):
failed to open stream: No such file or directory

and

file_put_contents(G:\project\storage\framework/sessions/aIXycR4LIAUBVIqZu0T590paOMIpV8vfZGIroEp0):
failed to open stream: No such file or directory

I'm searching problem decision with Google and find information about correct rights. All advice is about Linux, but I'am work in Windows at the office and at home too.

When I try to clear application cache and view cache, artisan talk to me - ...cleared. But cache data and views are present in storage.

How can I fix this problem?

Thanks in advance!

14条回答
Luminary・发光体
2楼-- · 2020-01-30 08:02

In case of shared hosting when you do not have command line access simply navigate to laravel/bootstrap/cache folder and delete (or rename) config.php and you are all done!

查看更多
做自己的国王
3楼-- · 2020-01-30 08:03

The best way to solve this problem is, go to directory "laravel/bootstrap/cache" and delete config.php file. or you can rename it as well like config.php.old And your problem will be fix. Happy coding :-)

查看更多
时光不老,我们不散
4楼-- · 2020-01-30 08:03

The reason for this problem is the cache files in localhost. According to that I've tried several things as follows to clear the cache on my project, but every time I've failed.

  • Tried to clear cahe commands by changing web.php file (with artisan codes)
  • Tried to clear cache by connecting SSH (via PUTTY)
  • Tried to host my project in Sub domain within create a new Public directory

So I've found a solution for this problem after each and every above steps failed and it worked for me perfectly. I deleted the cache.php file in host_route/bootstrap/cache directory.

I think this answer will help your problem.

查看更多
Viruses.
5楼-- · 2020-01-30 08:03

The best way to solve this problem is, go to directory laravel/bootstrap/cache and delete all files from cache.

To do this, run the following Artisan commands on your command line
1. php artisan config:clear
2. php artisan cache:clear
3. php artisan config:cache

In your panel or server, you can execute commands by adding the following to your routes:

    Route::get('/clear-cache', function() {
        $run = Artisan::call('config:clear');
        $run = Artisan::call('cache:clear');
        $run = Artisan::call('config:cache');
        return 'FINISHED';  
    });

And then call the www.yourdomain.com/clear-cache route from your browser.

查看更多
时光不老,我们不散
6楼-- · 2020-01-30 08:08

After some research I understand - I have very similar, but different root project locations and its cached in /bootstrap/cache. After cache clearing project started.

查看更多
Explosion°爆炸
7楼-- · 2020-01-30 08:08

Apache + WSL on windows

This is a silly mistake, and a different answer compared to the others, but I'll add it because it happened to me.

If you use WSL (linux bash on windows) to manage your laravel application, while using your windows apache to run your server, then running any caching commands in the wsl will store the linux path rather than the windows path to the sessions and other folders.

Solution

Simply run the cache clearing commands in the powershell, rather than in WSL.

$ php artisan optimize

Was enough for me.

查看更多
登录 后发表回答