【问题标题】:file_put_contents error on existing laravel project现有 laravel 项目上的 file_put_contents 错误
【发布时间】:2019-07-16 14:28:01
【问题描述】:

我正在尝试配置一个新的 laravel 项目,但是无论如何我总是收到以下错误:

file_put_contents(C:\Users\bla...\Documents\GitHub\project\storage\framework/sessions/yB2Ji8maEDu0fXZLpZ5VBnDzIhLdaeA7aYdVMjOf): failed to open stream: No such file or directory

我已经尝试重新安装 homestead/laravel/vagrant 我还一次又一次地运行以下和更多的工匠命令:

php artisan config:cache
php artisan cache:clear
php artisan optimize

我还对我的 vagrant box 内的文件/文件夹运行了 chmod 权限,但仍然没有什么能让我克服这个错误,有什么想法吗?该项目本身在我的 vm 中创建得非常好。

【问题讨论】:

  • 我的猜测是您正试图在 unix 或 linux 系统上安装它。我说的对吗?
  • 这是在 Windows 机器上,但基于 ubuntu 的 VM @RiggsFolly
  • C:\Users\bla...\Documents\...... 看起来像 Ubuntu 上可能存在的文件夹
  • 网站是在 Windows 上还是在 Linux 上运行?除非您在 Windows 中设置了 Web 服务器,否则应用程序中的所有路径都必须是 *nix-paths,而不是 Windows 路径。您的 VM 机器对您的 Windows 文件系统没有任何访问权限(或知识)。
  • 见上面的评论,你说这是一个运行在 Windows 主机上的 Ubuntu VM

标签: php laravel vagrant virtualbox


【解决方案1】:

删除你的Project/storage/framework/sessions中的所有文件,然后运行php artisan view:clearphp artisan config:clear

【讨论】:

  • 这不会解决 OP 在 Homestead 中运行的 PHP 应用程序中使用主机操作系统 (Windows) 文件路径的问题。
猜你喜欢
  • 2016-04-15
  • 1970-01-01
  • 1970-01-01
  • 2021-04-30
  • 2017-04-27
  • 2019-08-18
  • 1970-01-01
  • 2018-07-11
  • 2014-07-03
相关资源
最近更新 更多