Laravel 5.1,无法打开流:权限被拒绝

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31681134/
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-09-14 12:04:19  来源:igfitidea点击:

Laravel 5.1, failed to open stream: Permission denied

phplaravel

提问by ballerz

I am having a challenge uploading a file into app/storage. Upon uploading the file I get this error:
file_put_contents(C:\xampp\htdocs\ProjectName\storage\app\folderName): failed to open stream: Permission denied.

我在将文件上传到app/storage. 上传文件后,我收到此错误:
file_put_contents(C:\xampp\htdocs\ProjectName\storage\app\folderName): failed to open stream: Permission denied.

I tried using chmod -R 777 storage/app, but still have the same problem.

我尝试使用chmod -R 777 storage/app,但仍然有同样的问题。

Would really like know how to solve this problem.

真的很想知道如何解决这个问题。

回答by Ben Claar

Make sure apache has write access to PHP's temp folder (C:\xampp\tmp\usually) as well as all of storage(not just storage/app). Also, be sure the uploads folder actually exists (C:\xampp\htdocs\ProjectName\storage\app\folderName).

确保 apache 具有对 PHP 的临时文件夹(C:\xampp\tmp\通常)以及所有storage(不仅仅是存储/应用程序)的写访问权限。此外,请确保上传文件夹确实存在 ( C:\xampp\htdocs\ProjectName\storage\app\folderName)。

PHP first uploads files to the tmp folder, and then moves them into storage.

PHP 首先将文件上传到 tmp 文件夹,然后将它们移动到存储中。

Here's how to change permissions in Windows 7.

这是在 Windows 7 中更改权限的方法