I've added this to the array that is returned in config/app.php:

'components' => [
        'redis' => [
            'class' => yii\redis\Connection::class,
            'hostname' => App::env('REDIS_HOST'),
            'port' => APP::env('REDIS_PORT'),
            'password' => ''
        'cache' => [
            'class' => yii\redis\Cache::class,
            'defaultDuration' => 86400,
            'keyPrefix' => App::env('APP_ID') ?: 'CraftCMS',

        'session' => function() {
            // Get the default component config
            $config = App::sessionConfig();

            // Override the class to use Redis' session class
            $config['class'] = yii\redis\Session::class;

            // Instantiate and return it
            return Craft::createObject($config);

This all works find when my environment is in dev and devMode is on.

When I switch to production, I get an internal server error. I don't know what the issue is because it doesn't give me the full logs.

1 Answer 1


Luckily, someone else had this problem: https://github.com/craftcms/cms/issues/7617#issuecomment-786715807

The issue was because of leaving the password blank. devMode did not care, but production did. Had to remove the password entirely

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.