Support the ongoing development of Laravel.io →
Session Database

I would like to set up Redis to handle sessions, however, I found an issue. When I stop the Redis service I get a Predis \ Connection \ ConnectionException which makes sense, however, on a production server I want to handle this type of error better for users. For example, display my custom error page instead of the default error page that comes with Laravel for production errors and log the error.

I thought about adding a try catch to the index.php file, however, that is adding error logic in two places (global.php and index.php). I'm not sure what is the best way to go here.

Is there a way to make sure all system/php/laravel errors go through the global.php exception handling logic?

Would like to hear any thoughts on how to resolve this issue. Thanks.

In case there is an issue replicating this issue here is some meta information.

Code snippets

// index.php
try {
    $app->run();
}
catch (Exception $e)
{
    // handle exception
}

// global.php
App::error(function(Exception $exception, $code)
{
    // some logic...
    return Response::view('custom-error-page', $data, $code);
});
Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

nisaac2fly nisaac2fly Joined 18 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.