'无法打开流:权限被拒绝'错误 - Laravel 5.4

时间:2017-03-06 10:19:34

标签: php laravel laravel-5.4

我在Windows上运行我的网络服务器(XAMPP控制面板v3.2.2)。我正在创建这样的文件和文件夹:

use File;

...

$Path = app_path()
       . '/Projects/'
       . strtolower($Project->name)
       . '/Schema/';

if (File::exists($Path)) {
    $result = 1;
} else {
    $result = File::makeDirectory($unitPath , '775', true);

    $content = "the content is basically a whole controller";

    $file   = $Path . strtolower($Unit->name) . '.php';
    $bytes_written = File::put($file, $content);

    if ($bytes_written === false) {
        return false;
    }
}

我创建的文件是PHP控制器。

创建文件和文件夹。但是,通过使用git bash,我注意到该权限未设置为775,即使我已在makeDirectory中指定了该权限,但文件也是如此。

git bash enter image description here

如果我尝试从创建的文件(控制器)执行操作,那么我得到:

  

错误异常   C:\ xampp \ htdocs \ selenium \ vendor \ composer \ ClassLoader.php第440行:   include(C:\ xampp \ htdocs \ selenium):无法打开流:权限   拒绝

除了在Linux上运行我的网络服务器而不是Windows?我怎能解决这个问题?

注意:家里的电脑上的一切正常,我也在Windows上运行网络服务器。唯一的区别是我在家里使用 Windows 10 64bit ,而在工作中使用 Windows 7 64bit

更新:

执行include(C:\xampp\htdocs\selenium): failed to open stream: Permission denied后,ErrorException composer update消失了。但是如何创建具有特定权限的文件/文件夹的问题仍然存在。

更新2:

创建新文件后,ErrorException再次出现......

0 个答案:

没有答案