Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,208,913 members, 8,004,290 topics. Date: Saturday, 16 November 2024 at 01:14 PM

White Screen Error Solved & Getting Whoops! Back In Laravel 5 - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / White Screen Error Solved & Getting Whoops! Back In Laravel 5 (2216 Views)

Common Error In Laravel #1:solved File_put_contents Failed To Open Stream / Solution To Tokenmismatchexception Problem In Laravel 5.1 / Create A Nested Lists Of Categories In Laravel 5 (2) (3) (4)

(1) (Reply)

White Screen Error Solved & Getting Whoops! Back In Laravel 5 by dplumptre(m): 1:28pm On Nov 05, 2015
Hi peeps,

Have you ever worked on an application on laravel 5, but when you get an error

what you see is a white screen ,

what you need do a chmod 777 -R on the storage folder in your laravel application,

then you get the normal error , but for me I actually prefer to use the whoops error

this was in laravel 4 because its very detailed but it has been yanked off in laravel 5

A quick way to do this is first editing your composer.json file and adding

"filp/whoops": "~1.0", under the require so it looks somthing like this below

"require": {
"laravel/framework": "5.0.*",
"illuminate/html": "~5.0",
"filp/whoops": "~1.0",
"intervention/image": "^2.3"
},

you then go to laravel app from your terminal and do:

sudo composer update, after that you navigate to apps/Exceptions/handlers.php

add this method below to the Handler class:

protected function renderExceptionWithWhoops(Exception $e)
{
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());

return new \Illuminate\Http\Response(
$whoops->handleException($e),
$e->getStatusCode(),
$e->getHeaders()
);
}



then you look for a method "render " then add this in the method

if (config('app.debug'))
{
return $this->renderExceptionWithWhoops($e);
}


so it will look like this below

public function render($request, Exception $e)
{

if (config('app.debug'))
{
return $this->renderExceptionWithWhoops($e);
}

return parent::render($request, $e);
}





/**
* Render an exception using Whoops.
*
* @param \Exception $e
* @return \Illuminate\Http\Response
*/
protected function renderExceptionWithWhoops(Exception $e)
{
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());

return new \Illuminate\Http\Response(
$whoops->handleException($e),
$e->getStatusCode(),
$e->getHeaders()
);
}


then you are done






view more post on http://overallheuristic.com/blog/

site : http://overallheuristic.com
twitter : @dplumptre
fb :https://www.facebook.com/

Re: White Screen Error Solved & Getting Whoops! Back In Laravel 5 by danvery2k6(m): 6:26pm On Nov 05, 2015
I have been using Laravel 5 for some time now. I still get the `Whoops!` error message without going through much trouble. All I do is set an environment variable in my .env file called APP_DEBUG to true.

Like so:
APP_DEBUG=true


That does all the magic.

1 Like

Re: White Screen Error Solved & Getting Whoops! Back In Laravel 5 by dplumptre(m): 3:53pm On Nov 20, 2015
I havent had time to explain better,

If you look at the images I attached below you will see two different error pages ,

The colorful one is the Whoops error I was talking about , you can see it from the title , I actually prefer it that is why I go through those

steps before to make it display when using laravel 5.

On the other hand, the other one is the error page that appears when you install laravel 5 ,

you dont need any setting whatsoever , rather than to make the APP_DEBUG to true in your .env file

I dont really like it because its not as detailed and perhaps

less colourful but its your choice really to choose the one that works for you

(1) (Reply)

I'm A Guru In Visual Basic / How To Build An On-demand Platform Like Uber Or Airbnb / Who Has Ever Accessed The Dark Web Or Deep Web Share Your Experience

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 24
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.