Laravel 5 blade shows a blank page when there is error instead of throwing exception

拈花ヽ惹草 提交于 2019-12-03 21:31:34
Marcio Sartini

Try to change permission on the storage folder:

chmod -R 0777 storage

It worked for me.

I don't really know why this happened but its now working as required after i run

vagrant destroy to destroy homestead VM

and then vagrant up - to create the VM

The error messages has now showing up instead of blank page:

An alternative solution which helped me, is running

composer install 

I deployed with git which auto ignores some files. running composer install fixed it for me.

I got the same problem but here comes the reason and the solution: The logfiles in storage/logs needs to be owned/writable by the webserver user. Otherwise L5 gives you a blank page.

I run "php artisan ..." always as root. If an exception was thrown and Laravel creates a new logfile, then it's owned by root. On my Debian i run in the project root folder: chown www-data.root * -R to solve this problem.

//lavarel 4 * Add this to app/start/gobal.php

App::error(function(Exception $e, $code) {
            $runner = new \Whoops\Run;
            $inspect = new \Whoops\Exception\Inspector($e);
            $handler = new \Whoops\Handler\PrettyPageHandler;
            $handler->setRun($run);
            $handler->setInspector($insp);
            $handler->setException($e);
            return $handler->handle($e);
});

//lavarel 5 * Add this to app/Exceptions/Handler.php

 public function render($request, Exception $exception)
 {
    ..........
            $runner = new \Whoops\Run;
            $inspect = new \Whoops\Exception\Inspector($e);
            $handler = new \Whoops\Handler\PrettyPageHandler;
            $handler->setRun($run);
            $handler->setInspector($insp);
            $handler->setException($e);
            $handler->handle($e);
     ......
    return parent::render($request, $e);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!