title: How to setup Laravel-Session-Storage to Redis?
body: <p>Hi everyone I just want to store the session's of my laravel app in redis on localhost, redis-server is running, yesterday I tried Redis::set('key') and so on and it worked perfectly but storeing session in redis leads to this error -> Redis connection [redis] not configured.</p>
  
  <p>My .env-file: </p>
  
  <pre><code>BROADCAST_DRIVER=pusher
  CACHE_DRIVER=file
  SESSION_DRIVER=redis
  QUEUE_DRIVER=sync
  
  REDIS_HOST=127.0.0.1
  REDIS_PASSWORD=null
  REDIS_PORT=6379
  </code></pre>
  
  <p>my config/session.php file</p>
  
  <pre><code>&lt;?php
  
  return [
  
      /*
      |--------------------------------------------------------------------------
      | Default Session Driver
      |--------------------------------------------------------------------------
      |
      | This option controls the default session "driver" that will be used on
      | requests. By default, we will use the lightweight native driver but
      | you may specify any of the other wonderful drivers provided here.
      |
      | Supported: "file", "cookie", "database", "apc",
      |            "memcached", "redis", "array"
      |
      */
  
      'driver' =&gt; env('SESSION_DRIVER', 'redis'),
  
  
      /*
      |--------------------------------------------------------------------------
      | Session Lifetime
      |--------------------------------------------------------------------------
      |
      | Here you may specify the number of minutes that you wish the session
      | to be allowed to remain idle before it expires. If you want them
      | to immediately expire on the browser closing, set that option.
      |
      */
  
      'lifetime' =&gt; 120,
  
      'expire_on_close' =&gt; true,
  
      /*
      |--------------------------------------------------------------------------
      | Session Encryption
      |--------------------------------------------------------------------------
      |
      | This option allows you to easily specify that all of your session data
      | should be encrypted before it is stored. All encryption will be run
      | automatically by Laravel and you can use the Session like normal.
      |
      */
  
      'encrypt' =&gt; false,
  
      /*
      |--------------------------------------------------------------------------
      | Session File Location
      |--------------------------------------------------------------------------
      |
      | When using the native session driver, we need a location where session
      | files may be stored. A default has been set for you but a different
      | location may be specified. This is only needed for file sessions.
      |
      */
  
      'files' =&gt; storage_path('framework/sessions'),
  
      /*
      |--------------------------------------------------------------------------
      | Session Database Connection
      |--------------------------------------------------------------------------
      |
      | When using the "database" or "redis" session drivers, you may specify a
      | connection that should be used to manage these sessions. This should
      | correspond to a connection in your database configuration options.
      |
      */
  
      'connection' =&gt; 'redis',
  
      /*
      |--------------------------------------------------------------------------
      | Session Database Table
      |--------------------------------------------------------------------------
      |
      | When using the "database" session driver, you may specify the table we
      | should use to manage the sessions. Of course, a sensible default is
      | provided for you; however, you are free to change this as needed.
      |
      */
  
      'table' =&gt; 'sessions',
  
      /*
      |--------------------------------------------------------------------------
      | Session Cache Store
      |--------------------------------------------------------------------------
      |
      | When using the "apc" or "memcached" session drivers, you may specify a
      | cache store that should be used for these sessions. This value must
      | correspond with one of the application's configured cache stores.
      |
      */
  
      'store' =&gt; null,
  
      /*
      |--------------------------------------------------------------------------
      | Session Sweeping Lottery
      |--------------------------------------------------------------------------
      |
      | Some session drivers must manually sweep their storage location to get
      | rid of old sessions from storage. Here are the chances that it will
      | happen on a given request. By default, the odds are 2 out of 100.
      |
      */
  
      'lottery' =&gt; [2, 100],
  
      /*
      |--------------------------------------------------------------------------
      | Session Cookie Name
      |--------------------------------------------------------------------------
      |
      | Here you may change the name of the cookie used to identify a session
      | instance by ID. The name specified here will get used every time a
      | new session cookie is created by the framework for every driver.
      |
      */
  
      'cookie' =&gt; 'laravel_session',
  
      /*
      |--------------------------------------------------------------------------
      | Session Cookie Path
      |--------------------------------------------------------------------------
      |
      | The session cookie path determines the path for which the cookie will
      | be regarded as available. Typically, this will be the root path of
      | your application but you are free to change this when necessary.
      |
      */
  
      'path' =&gt; '/',
  
      /*
      |--------------------------------------------------------------------------
      | Session Cookie Domain
      |--------------------------------------------------------------------------
      |
      | Here you may change the domain of the cookie used to identify a session
      | in your application. This will determine which domains the cookie is
      | available to in your application. A sensible default has been set.
      |
      */
  
      'domain' =&gt; env('SESSION_DOMAIN', null),
  
      /*
      |--------------------------------------------------------------------------
      | HTTPS Only Cookies
      |--------------------------------------------------------------------------
      |
      | By setting this option to true, session cookies will only be sent back
      | to the server if the browser has a HTTPS connection. This will keep
      | the cookie from being sent to you if it can not be done securely.
      |
      */
  
      'secure' =&gt; env('SESSION_SECURE_COOKIE', false),
  
      /*
      |--------------------------------------------------------------------------
      | HTTP Access Only
      |--------------------------------------------------------------------------
      |
      | Setting this value to true will prevent JavaScript from accessing the
      | value of the cookie and the cookie will only be accessible through
      | the HTTP protocol. You are free to modify this option if needed.
      |
      */
  
      'http_only' =&gt; true,
  
  ];
  </code></pre>
  
  <p>My config/database.php file</p>
  
  <pre><code>&lt;?php
  
  return [
  
      /*
      |--------------------------------------------------------------------------
      | Default Database Connection Name
      |--------------------------------------------------------------------------
      |
      | Here you may specify which of the database connections below you wish
      | to use as your default connection for all database work. Of course
      | you may use many connections at once using the Database library.
      |
      */
  
      'default' =&gt; env('DB_CONNECTION', 'mysql'),
  
      /*
      |--------------------------------------------------------------------------
      | Database Connections
      |--------------------------------------------------------------------------
      |
      | Here are each of the database connections setup for your application.
      | Of course, examples of configuring each database platform that is
      | supported by Laravel is shown below to make development simple.
      |
      |
      | All database work in Laravel is done through the PHP PDO facilities
      | so make sure you have the driver for your particular database of
      | choice installed on your machine before you begin development.
      |
      */
  
      'connections' =&gt; [
  
          'sqlite' =&gt; [
              'driver' =&gt; 'sqlite',
              'database' =&gt; env('DB_DATABASE', database_path('database.sqlite')),
              'prefix' =&gt; '',
          ],
  
          'mysql' =&gt; [
              'driver' =&gt; 'mysql',
              'host' =&gt; env('DB_HOST', '127.0.0.1'),
              'port' =&gt; env('DB_PORT', '3306'),
              'database' =&gt; env('DB_DATABASE', 'forge'),
              'username' =&gt; env('DB_USERNAME', 'forge'),
              'password' =&gt; env('DB_PASSWORD', ''),
              'unix_socket' =&gt; env('DB_SOCKET', ''),
              'charset' =&gt; 'utf8mb4',
              'collation' =&gt; 'utf8mb4_unicode_ci',
              'prefix' =&gt; '',
              'strict' =&gt; true,
              'engine' =&gt; 'InnoDB ROW_FORMAT=DYNAMIC',
          ],
  
          'pgsql' =&gt; [
              'driver' =&gt; 'pgsql',
              'host' =&gt; env('DB_HOST', '127.0.0.1'),
              'port' =&gt; env('DB_PORT', '5432'),
              'database' =&gt; env('DB_DATABASE', 'forge'),
              'username' =&gt; env('DB_USERNAME', 'forge'),
              'password' =&gt; env('DB_PASSWORD', ''),
              'charset' =&gt; 'utf8',
              'prefix' =&gt; '',
              'schema' =&gt; 'public',
              'sslmode' =&gt; 'prefer',
          ],
  
          'sqlsrv' =&gt; [
              'driver' =&gt; 'sqlsrv',
              'host' =&gt; env('DB_HOST', 'localhost'),
              'port' =&gt; env('DB_PORT', '1433'),
              'database' =&gt; env('DB_DATABASE', 'forge'),
              'username' =&gt; env('DB_USERNAME', 'forge'),
              'password' =&gt; env('DB_PASSWORD', ''),
              'charset' =&gt; 'utf8',
              'prefix' =&gt; '',
          ],
  
          'redis' =&gt; [
              'client' =&gt; 'predis',
              'cluster' =&gt; false,
              'default' =&gt; [
                  'host' =&gt; env('REDIS_HOST', '127.0.0.1'),
                  'password' =&gt; env('REDIS_PASSWORD', null),
                  'port' =&gt; env('REDIS_PORT', 6379),
                  'database' =&gt; 0,
              ],
          ],
      ],
  
      /*
      |--------------------------------------------------------------------------
      | Migration Repository Table
      |--------------------------------------------------------------------------
      |
      | This table keeps track of all the migrations that have already run for
      | your application. Using this information, we can determine which of
      | the migrations on disk haven't actually been run in the database.
      |
      */
  
      'migrations' =&gt; 'migrations',
  
      /*
      |--------------------------------------------------------------------------
      | Redis Databases
      |--------------------------------------------------------------------------
      |
      | Redis is an open source, fast, and advanced key-value store that also
      | provides a richer set of commands than a typical key-value systems
      | such as APC or Memcached. Laravel makes it easy to dig right in.
      |
      */
      'redis' =&gt; [
          'client' =&gt; 'predis',
          'cluster' =&gt; false,
          'default' =&gt; [
              'host' =&gt; env('REDIS_HOST', '127.0.0.1'),
              'password' =&gt; env('REDIS_PASSWORD', null),
              'port' =&gt; env('REDIS_PORT', 6379),
              'database' =&gt; 0,
          ],
      ],
  ];
  </code></pre>
  
  <p>If I delete/cut one of 'redis' within the database.php file it still doesn't work or i get following error:array_key_exists() expects parameter 2 to be array null given. I followed Laravel Documentation don't know what I'm doing wrong couldn't be so hard to setup 3 files with/for redis ...</p>
  
  <p>Thank you very much for any help or ideas :)</p>