php – Laravel Permission被拒绝

前端之家收集整理的这篇文章主要介绍了php – Laravel Permission被拒绝前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
今晚,我试图运行composer安装和所有的依赖安装正确,然后作曲家运行PHP artisan清除编译,我遇到麻烦.

这是它返回的错误

> PHP artisan clear-compiled


  [ErrorException]                                                                                                        
  file_put_contents(/srv/something/site/bootstrap/cache/services.PHP): Failed to open stream: No such file or directory  


Script PHP artisan clear-compiled handling the post-install-cmd event returned with an error



  [RuntimeException]  
  Error Output:       



install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-plugins] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--ignore-platform-reqs] [--] [<packages>]...

自然地,我搜了一下,发现laracast forums的所有人都说这个目录是丢失的,所以我做了,命令跑得再好一点.当我去任何页面我得到这个:file_put_contents(/differentNameDependingOnPageButAlwaysRandomLettersAndNumbers.PHP):无法打开流:权限被拒绝

例如,这里是登录页面的追溯:

ErrorException in Filesystem.PHP line 81:
file_put_contents(/8ff8cea6e3bb10ecec87b9d62c64f9768c4c4ab1.PHP): Failed to open stream: Permission denied
in Filesystem.PHP line 81
at HandleExceptions->handleError('2','file_put_contents(/8ff8cea6e3bb10ecec87b9d62c64f9768c4c4ab1.PHP): Failed to open stream: Permission denied','/srv/something/site/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.PHP','81',array('path' => '/8ff8cea6e3bb10ecec87b9d62c64f9768c4c4ab1.PHP','contents' => '<?PHP $__env->startSection('title'); ?> Admin Login <?PHP $__env->stopSection(); ?> <?PHP $__env->startSection('form'); ?> <form class="form-horizontal" method="POST" action = "login"> <?PHP echo e($error); ?><?PHP /*TODO this doesn't show up now,when you do login make it show up*/ ?> <fieldset> <!-- Form Name --> <h1 class="section-heading" style="text-align: center;">Login</h1> <!-- Text input--> <div class="form-group"> <label class="col-md-4 control-label" for="email">Email</label> <div class="col-md-4"> <input id="email" name="email" type="email" id = "email" placeholder="user@domain.com" class="form-control input-md" required=""> </div> </div> <!-- Password input--> <div class="form-group"> <label class="col-md-4 control-label" for="password">Password</label> <div class="col-md-4"> <input id="password" name="password" type="password" placeholder="********" class="form-control input-md" required=""> </div> </div> <!-- Button --> <div class="form-group"> <label class="col-md-4 control-label" for="Submit"></label> <div class="col-md-4"> <button id="submit" name="submit" class="btn btn-primary">Submit</button> </div> </fieldset> </form> <?PHP $__env->stopSection(); ?> <?PHP $__env->startSection('message'); ?> <p class="text-muted" style="text-align:center">Don't have an account yet? Click <a href="../register">here</a> to register.</p> <?PHP $__env->stopSection(); ?> <?PHP echo $__env->make('auth.partials.master',array_except(get_defined_vars(),array('__data','__path')))->render(); ?>','lock' => false))
at file_put_contents('/8ff8cea6e3bb10ecec87b9d62c64f9768c4c4ab1.PHP','<?PHP $__env->startSection('title'); ?> Admin Login <?PHP $__env->stopSection(); ?> <?PHP $__env->startSection('form'); ?> <form class="form-horizontal" method="POST" action = "login"> <?PHP echo e($error); ?><?PHP /*TODO this doesn't show up now,'0') in Filesystem.PHP line 81
at Filesystem->put('/8ff8cea6e3bb10ecec87b9d62c64f9768c4c4ab1.PHP','__path')))->render(); ?>') in BladeCompiler.PHP line 102
at BladeCompiler->compile('/srv/something/site/resources/views/auth/login.blade.PHP') in CompilerEngine.PHP line 51
at CompilerEngine->get('/srv/something/site/resources/views/auth/login.blade.PHP',array('__env' => object(Factory),'app' => object(Application),'error' => '')) in View.PHP line 135
at View->getContents() in View.PHP line 106
at View->renderContents() in View.PHP line 80
at View->render() in Response.PHP line 53
at Response->setContent(object(View)) in Response.PHP line 197
at Response->__construct(object(View)) in Router.PHP line 1030
at Router->prepareResponse(object(Request),object(View)) in ControllerDispatcher.PHP line 95
at ControllerDispatcher->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure),object(Request)) in Pipeline.PHP line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure),object(Request)) in Pipeline.PHP line 103
at Pipeline->then(object(Closure)) in ControllerDispatcher.PHP line 96
at ControllerDispatcher->callWithinStack(object(authController),object(Route),object(Request),'getAdminLogin') in ControllerDispatcher.PHP line 54
at ControllerDispatcher->dispatch(object(Route),'App\Http\Controllers\authController','getAdminLogin') in Route.PHP line 174
at Route->runController(object(Request)) in Route.PHP line 140
at Route->run(object(Request)) in Router.PHP line 703
at Router->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure),object(Request)) in Pipeline.PHP line 103
at Pipeline->then(object(Closure)) in Router.PHP line 705
at Router->runRouteWithinStack(object(Route),object(Request)) in Router.PHP line 678
at Router->dispatchToRoute(object(Request)) in Router.PHP line 654
at Router->dispatch(object(Request)) in Kernel.PHP line 246
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure),object(Request)) in Pipeline.PHP line 52
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.PHP line 44
at CheckForMaintenanceMode->handle(object(Request),object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode),'handle'),array(object(Request),object(Closure))) in Pipeline.PHP line 124
at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure),object(Request)) in Pipeline.PHP line 32
at Pipeline->Illuminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure),object(Request)) in Pipeline.PHP line 103
at Pipeline->then(object(Closure)) in Kernel.PHP line 132
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.PHP line 99
at Kernel->handle(object(Request)) in index.PHP line 54

到目前为止,为了解决这个问题,我做了以下工作:

>已检查的权限,将所有内容更改为777,并由www-data拥有
>尝试使用没有供应商文件重新抛出空的存储库,无法使用,在作曲家安装时也是同样的错误
Ran PHP工匠缓存:清除
Ranpp工匠清晰编译
> Ran Ran Ran…….
>修改site / config / view.PHP在irc建议,并修改编译’=> realpath(storage_path().’/ framework / views’)to’compiled’=> storage_path(‘framework / views’),它产生了一个不同的错误:file_put_contents(/srv/something/site/storage/framework/views/8ff8cea6e3bb10ecec87b9d62c64f9768c4c4ab1.PHP):无法打开流:没有这样的文件或目录(可能是因为它不是应该在那里,但谁知道这些信息可能是有用的.)

所有这一切都无济于事.这个奇怪的部分是这个问题似乎从无处可见.谢谢您的帮助!

原来我在laravel_root / storage /中缺少一个视图目录.为了解决这个问题,我所要做的只有:

> cd {laravel_root} / storage
> mkdir -pv框架/视图应用程序框架/会话框架/缓存
> cd ..
> chmod 777 -R存储
> chown -R www-data:www-data storage

之后,重新加载时,问题已经解决.感谢来自#laravel的fangode的Someguy123解决这个问题!

猜你在找的Laravel相关文章