php file_put_contents ,无法打开流:没有这样的文件或目录 Laravel

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32126122/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 22:47:46  来源:igfitidea点击:

file_put_contents , failed to open stream: No such file or directory Laravel

phplaravel

提问by Wahid Nahiyan

I just want to run my client's project in to my local and having this problem.

我只想将我客户的项目运行到我的本地并遇到这个问题。

ErrorException in compiled.php line 6301: file_put_contents(C:\xampp\htdocs\tiger\storage/framework/views/111182673e168569a2371e23629d9c08): failed to open stream: No such file or directory

在compiled.php line 6301中的ErrorException: file_put_contents(C:\xampp\htdocs\tiger\storage/framework/views/111182673e168569a2371e23629d9c08): 无法打开流: 没有这样的文件或目录

it is something like permission issue .. and i am windows user don't know how to figure it ... experts can u help me ? Thanks in Advance.

这有点像许可问题..我是Windows用户不知道如何解决它......专家你能帮我吗?提前致谢。

回答by Ethan Hohensee

In case anyone here is using Homestead like me, you can run into the same issue using PHPUnit.

如果这里有人像我一样使用 Homestead,您可以使用 PHPUnit 遇到同样的问题。

When you run php artisan config:cache, Laravel hardcodes some paths in the cache. If you run it on your Homestead VM, it uses those paths. If you run it from your workstation, it uses those paths. You should make your cache from the Homestead VM and then execute your tests from there as well to avoid cache problems.

当您运行 时php artisan config:cache,Laravel 会硬编码缓存中的一些路径。如果你在 Homestead VM 上运行它,它会使用这些路径。如果您从工作站运行它,它将使用这些路径。你应该从 Homestead VM 创建你的缓存,然后从那里执行你的测试以避免缓存问题。

You can tell when the cache needs to be cleared by looking at the file path that PHPUnit tries to use. If it's not a valid path on the machine you're running the command from, you need to rebuild your cache.

您可以通过查看 PHPUnit 尝试使用的文件路径来判断何时需要清除缓存。如果它不是运行命令的机器上的有效路径,则需要重建缓存。

回答by imal hasaranga perera

I had the same exact problem, try this

我有同样的问题,试试这个

chmod -R guo+w storage

php artisan cache:clear

回答by Viktor Jarnheimer

This solves the problem

这解决了问题

php artisan cache:clear

回答by Bijaya Kumar Oli

php artisan config:cache

This code clear the cache and delete cache files.

此代码清除缓存并删除缓存文件。

回答by Surya Neupane

Inside the folder C:\xampp\htdocs\tiger\storage/framework/views make a file named 111182673e168569a2371e23629d9c08

在文件夹 C:\xampp\htdocs\tiger\storage/framework/views 内创建一个名为 111182673e168569a2371e23629d9c08 的文件

now refresh your browser this should solve your problem in window for linux users you should provide permission to for this file

现在刷新您的浏览器,这应该可以解决您在 linux 用户窗口中的问题,您应该为此文件提供权限