  You're browsing the documentation for an old version of SupportPal. Consider upgrading to the [latest version](https://docs.supportpal.com/current/Cloud+Storage). 

# Changing File Storage Path

By default, SupportPal uses file-based storage in the `/storage` directory. In some cases, the storage location can be changed to another directory or a specialist system such as Amazon S3 or Memcached.

The local file storage, `/storage` directory, is broken down into 3 sub-directories. If you would like to move the entire `/storage` directory outside of the web root this must be done in separate steps. The steps for updating each sub-directory have been outlined below:

## Application Storage

By default attachments and other caches are stored locally to the `/storage/app` directory within your SupportPal installation directory. It is possible to change the location of this directory, and we also support storing *some* files on Amazon S3:

  Create a new file `filesystems.php` in the `/config/production` folder instead of updating the `filesystems.php` found in the main `/config` folder, this will mean your configuration is not lost when you update your system. 

### Local

If you would like to change the default directory, please use the configuration below:

 Local /config/production/filesystems.php  Expand  Collapse

```

    <?php

    return [

        'default' => 'local',

        'disks' => [

            'local' => [
                'driver' => 'local',
                'root'   => '/absolute/path/to/writable/directory', // Do not include trailing slash
            ],

        ],

    ];

```

### Amazon S3

To use Amazon S3 you must permit [allow\_url\_fopen](http://php.net/manual/en/filesystem.configuration.php) in your PHP configuration.

 



If you would like to configure an Amazon S3 filesystem, please use configuration below:

 Amazon S3 /config/production/filesystems.php  Expand  Collapse

```

    <?php

    return [

        'default' => 's3',

        'disks' => [

            's3' => [
                'driver' => 's3',
                'key'    => 'your-key',
                'secret' => 'your-secret',
                'region' => 'your-region',
                'bucket' => 'your-bucket',
            ],

        ],

    ];

```

## Framework Storage Directories

The `/storage/framework` directory is broken down into a number of smaller sub-directories.

### Cache

For details on updating the cache file store, please see: [Changing Cache Store](Changing+Cache+Store).

### Sessions

By default, SupportPal uses file storage and all PHP sessions are stored in the `/storage/framework/sessions` directory.

#### Available Session Stores

- `file` - sessions are stored in `/storage/framework/sessions`.
- `cookie` - sessions are stored in secure, encrypted cookies.
- `redis` - sessions are stored in fast, cache based stores, requires Redis database to be configured.
- `memcached` - sessions are stored in fast, cache based stores, requires the [Memcached PECL package](http://pecl.php.net/package/memcached) to be installed.

  Create a new file `session.php` in the `/config/production` folder instead of updating the `session.php` found in the main `/config` folder, this will mean your configuration is not lost when you update your system. 

##### File-based

If you would like to change change the default directory for where sessions are stored, please use the configuration below:

 File-based Sessions  Expand  Collapse

```

    <?php

    return [

        'driver' => 'file',

        'files'  => '/absolute/path/to/writable/directory', // Do not including trailing slash

    ];

```

##### Database

If you would like to store sessions in the database, you will need to firstly create the sessions database table. This can be achieved by running `php artisan session:table` from the command line. Once complete, please use the configuration below:

 Database-based Sessions  Expand  Collapse

```

    <?php

    return [

        'driver'     => 'database',

        'connection' => 'mysql',

        'table'      => 'sessions',

    ];

```

##### Memcached

  Do not use memcached as both your cache and session driver! When the cache is cleared, all of your sessions will also be deleted. 

If you would like to store session data in memcached, please use the configuration below:

 Memcached-based Sessions  Expand  Collapse

```

    <?php

    return [

        'driver' => 'memcached',

    ];

```

##### Redis

Do not use the same redis database for both your cache and session driver! The configuration steps described in this documentation will ensure a separate database is configured for each driver.

 



If you would like to store session data in Redis, please follow the below steps:

1. Make sure your PHP configuration doesn't have any `disable_functions` listed. You can check this via Utilities > PHP Information within the operator panel, but please also ensure your PHP CLI (cron) configuration also has the same setup.
2. Add your Redis connection information to `/config/production/database.php` (don't edit your MySQL configuration). To ensure a separate Redis database is created for sessions, please ensure the database parameter in the `'session'` array is unique:  /config/production/database.php  Expand  Collapse 
    
     ```
    
                <?php
    
                return [
    
                    'connections' => [
    
                        'mysql' => [
                            ...
                        ],
    
                    ],
    
                    'redis' => [
                        'cluster' => false,
                        'default' => [
                            ...
                        ],
                        'session' => [
                            'host'     => '192.168.1.150',
                            'port'     => 6379,
                            'database' => 1,
                        ]
                    ],
    
                ];
            
    ```
3. Change `/config/production/session.php` ```
    
                <?php return [ 'driver' => 'redis', 'connection' => 'session', ];
            
    ```

### Views

The `/storage/framework/views` directory is used to store compiled copies of templates, this helps to speed up the load-time of your application. It's possible to change the location of this directory to outside the web root:

  Create a new file `view.php` in the `/config/production` folder instead of updating the `view.php` found in the main `/config` folder, this will mean your configuration is not lost when you update your system. 

 /config/production/view.php  Expand  Collapse

```

    <?php

    return [

        /*
        |--------------------------------------------------------------------------
        | Compiled View Path
        |--------------------------------------------------------------------------
        |
        | This option determines where all the compiled Blade templates will be
        | stored for your application. Typically, this is within the storage
        | directory. However, as usual, you are free to change this value.
        |
        */

        'compiled' => realpath('/absolute/path/to/writable/directory'), // Do not include a trailing slash.

    ];

```

## Logs

By default, all SupportPal application logs are stored in the `/storage/logs` directory. It is possible to change the directory where logs are stored:

 /config/production/app.php  Expand  Collapse

```

    <?php

    return [

        'log_path' => '/absolute/path/to/logs', // Do not include a trailing slash.

    ];

```

We recommend purging this directory every now and again in order to ensure it doesn't grow too large.