Change Storage Folder

Hi,
I am a new user of cockpitcms.
I would like to ask, is it possible to move “Storage” folder to outside the cockpits folder (ie, on (docroot)/storage) ?
Thank you.

Think should be possible, try to add to your config.yaml something like:

paths:
  "#storage": /var/www/your-storage-folder

try putting this to your settings:

          finder.path : /new_storage
          assets.path : /new_storage/assets
          media.path : /new_storage/media

thank you @pauloamgomes and @serjoscha87 for your response.
I try the @pauloamgomes method. And it works!

It doesn’t work with version 0.10.0. I need to move the storage folder on another disk, tried to add your config but cockpitcms stills refer to the storage folder inside the webroot.

Any idea?

yes, you need a few more replacements in the configuration, e.g.:

paths:
  "#storage": /var/www/html/storage2
  "#pstorage": /var/www/html/storage2
  "#data" /var/www/html/storage2/data
  "#cache": /var/www/html/storage2/cache
  "#tmp": /var/www/html/storage2/tmp
  "#thumbs": /var/www/html/storage2/thumbs
  "#uploads": /var/www/html/storage2/uploads

I’m still getting a 500:
#data”:

    paths:
        "#storage": /ssd2/cockpitcms/storage
        "#pstorage": /ssd2/cockpitcms/storage
        "#data": /ssd2/cockpitcms/storage/data
        "#cache": /ssd2/cockpitcms/storage/cache
        "#tmp": /ssd2/cockpitcms/storage/tmp
        "#thumbs": /ssd2/cockpitcms/storage/thumbs
        "#uploads": /ssd2/cockpitcms/storage/uploads

When searching for pstorage, I get:

./config/config.yaml:#    "#pstorage": /ssd2/cockpitcms/storage
./modules/Cockpit/Controller/Utils.php:        $dirs = ['#cache:','#tmp:','#thumbs:', '#pstorage:tmp'];
./modules/Cockpit/views/layouts/app.php:        var PUBLIC_STORAGE_URL = '{{ rtrim($app->pathToUrl('#pstorage:'), '/') }}';
./modules/Cockpit/bootstrap.php:        $dirs = ['#cache:','#tmp:','#thumbs:', '#pstorage:tmp'];
./bootstrap.php:                '#pstorage' => COCKPIT_PUBLIC_STORAGE_FOLDER,
./storage/tmp/app.php.xxx.lexy.php:        var PUBLIC_STORAGE_URL = '<?php echo  rtrim($app->pathToUrl('#pstorage:'), '/') ; ?>';
./lib/LimeExtra/App.php:            $path = '#pstorage:tmp/'.$jshash.'.js';

thats weird, I tested with the above changes, copied storage to another place and it worked

Indeed, I don’t get it either…
For now I am using a symbolic link. Seems to do the job.

Thanks for your time Paulo.

just FYI, from the beginning until now, I still use it. and there is no problem.

Cockpit settings

paths:
#storage”: /home/mydomain/web/mydomain.com/public_html/storage
#data”: /home/mydomain/web/mydomain.com/public_html/storage/data
#cache”: /home/mydomain/web/mydomain.com/public_html/storage/cache
#tmp”: /home/mydomain/web/mydomain.com/public_html/storage/tmp
#thumbs”: /home/mydomain/web/mydomain.com/public_html/storage/thumbs
#uploads”: /home/mydomain/web/mydomain.com/public_html/storage/uploads

Make sure you set correct owner and permission (recursive) on the storage folder.

1 Like

Not sure, if it is related - I had an issue in the past with Xampp7 on a Windows machine, where array_replace_recursive with key names starting with # crashed the apache. I had this issue when fiddling and testing with these paths via config.yaml.