为了账号安全,请及时绑定邮箱和手机立即绑定

laravel5.5.*初始化的新项目报错

laravel5.5.*初始化的新项目报错

PHP
繁星点点滴滴 2019-03-16 23:11:11
环境centos 7.0nginx: 1.12.2php: 7.1.12访问间的路径是http://centos7.com/php/blog/server.php报错信息是: file_put_contents(/vagrant/php/blog/storage/framework/views/7fb79758ff256713f26e772997799b4741bdee06.php): failed to open stream: Permission denied 在此之前报错The stream or file "/vagrant/php/blog/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied,手动新建了文件laravel.log并给予了777权限。 最后文件laravel.log里面的内容是 [2017-12-04 11:45:40] local.ERROR: file_put_contents(/vagrant/php/blog/storage/framework/views/7fb79758ff256713f26e772997799b4741bdee06.php): failed to open stream: Permission denied {"exception":"[object] (ErrorException(code: 0): file_put_contents(/vagrant/php/blog/storage/framework/views/7fb79758ff256713f26e772997799b4741bdee06.php): failed to open stream: Permission denied at /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122) [stacktrace] #0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'file_put_conten...', '/vagrant/php/bl...', 122, Array) #1 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(122): file_put_contents('/vagrant/php/bl...', '<!doctype html>...', 0) #2 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(121): Illuminate\\Filesystem\\Filesystem->put('/vagrant/php/bl...', '<!doctype html>...') #3 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(51): Illuminate\\View\\Compilers\\BladeCompiler->compile('/vagrant/php/bl...') #4 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/View/View.php(137): Illuminate\\View\\Engines\\CompilerEngine->get('/vagrant/php/bl...', Array) #5 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/View/View.php(120): Illuminate\\View\\View->getContents() #6 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/View/View.php(85): Illuminate\\View\\View->renderContents() #7 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Http/Response.php(42): Illuminate\\View\\View->render() #8 /vagrant/php/blog/vendor/symfony/http-foundation/Response.php(200): Illuminate\\Http\\Response->setContent(Object(Illuminate\\View\\View)) #9 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(724): Symfony\\Component\\HttpFoundation\\Response->__construct(Object(Illuminate\\View\\View)) #10 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(698): Illuminate\\Routing\\Router::toResponse(Object(Illuminate\\Http\\Request), Object(Illuminate\\View\\View)) #11 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(658): Illuminate\\Routing\\Router->prepareResponse(Object(Illuminate\\Http\\Request), Object(Illuminate\\View\\View)) #12 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request)) #13 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request)) #14 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure)) #15 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request)) #16 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(67): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request)) #17 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure)) #18 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request)) #19 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request)) #20 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure)) #21 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request)) #22 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(63): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request)) #23 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure)) #24 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request)) #25 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request)) #26 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure)) #27 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request)) #28 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request)) #29 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure)) #30 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request)) #31 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request)) #32 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(660): Illuminate\\Pipeline\\Pipeline->then(Object(Closure)) #33 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request)) #34 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(601): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route)) #35 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Router.php(590): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request)) #36 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request)) #37 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request)) #38 /vagrant/php/blog/vendor/fideloper/proxy/src/TrustProxies.php(56): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request)) #39 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure)) #40 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request)) #41 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request)) #42 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure)) #43 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request)) #44 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request)) #45 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure)) #46 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request)) #47 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request)) #48 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure)) #49 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request)) #50 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request)) #51 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure)) #52 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request)) #53 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request)) #54 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure)) #55 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request)) #56 /vagrant/php/blog/public/index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request)) #57 /vagrant/php/blog/server.php(21): require_once('/vagrant/php/bl...') #58 {main} "} [2017-12-04 11:45:41] local.ERROR: file_put_contents(/vagrant/php/blog/storage/framework/sessions/pDxhcLk25Q40b6qY1WRy3GLejRvIM1COWU4oy1gX): failed to open stream: Permission denied {"exception":"[object] (ErrorException(code: 0): file_put_contents(/vagrant/php/blog/storage/framework/sessions/pDxhcLk25Q40b6qY1WRy3GLejRvIM1COWU4oy1gX): failed to open stream: Permission denied at /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:122) [stacktrace] #0 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'file_put_conten...', '/vagrant/php/bl...', 122, Array) #1 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(122): file_put_contents('/vagrant/php/bl...', 'a:3:{s:6:\"_toke...', 2) #2 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Session/FileSessionHandler.php(83): Illuminate\\Filesystem\\Filesystem->put('/vagrant/php/bl...', 'a:3:{s:6:\"_toke...', true) #3 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Session/Store.php(128): Illuminate\\Session\\FileSessionHandler->write('pDxhcLk25Q40b6q...', 'a:3:{s:6:\"_toke...') #4 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(87): Illuminate\\Session\\Store->save() #5 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(218): Illuminate\\Session\\Middleware\\StartSession->terminate(Object(Illuminate\\Http\\Request), Object(Illuminate\\Http\\Response)) #6 /vagrant/php/blog/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(189): Illuminate\\Foundation\\Http\\Kernel->terminateMiddleware(Object(Illuminate\\Http\\Request), Object(Illuminate\\Http\\Response)) #7 /vagrant/php/blog/public/index.php(60): Illuminate\\Foundation\\Http\\Kernel->terminate(Object(Illuminate\\Http\\Request), Object(Illuminate\\Http\\Response)) #8 /vagrant/php/blog/server.php(21): require_once('/vagrant/php/bl...') #9 {main} "}
查看完整描述

3 回答

?
米琪卡哇伊

TA贡献1998条经验 获得超6个赞

storage整个目录的权限都改吧。

查看完整回答
反对 回复 2019-03-18
?
牧羊人nacy

TA贡献1862条经验 获得超7个赞

给你几个参考点:

* 父级权限不够,导致下级无法写入.
* 父级权限足够,但是文件权限不够.就要重新生成文件.

最简单方法就是删除整个文件夹.然后重新生成一次.新建立一个,所有文件重新生成.
万事大吉.

查看完整回答
反对 回复 2019-03-18
?
蓝山帝景

TA贡献1843条经验 获得超7个赞

同出现这个错误,找了半天,最终发现是linux的selinux问题,把这个关了就能正常访问了。

查看完整回答
反对 回复 2019-03-18
  • 3 回答
  • 0 关注
  • 640 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信