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.

Contents

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:

Local

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


    <?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 in your PHP configuration.

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


    <?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.

Sessions

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

Available Session Stores

File-based

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


    <?php

    return [

        'driver' => 'file',

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

    ];
Memcached

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


    <?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:
    
                <?php
    
                return [
    
                    'connections' => [
    
                        'mysql' => [
                            ...
                        ],
    
                    ],
    
                    'redis' => [
                        'client' => 'predis',
                        'default' => [
                            'host'     => '192.168.1.150',
                            'port'     => 6379,
                            'database' => 0,
                        ],
                        '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:


    <?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:


    <?php

    return [

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

    ];