Jump to:

4935 Posts in 16002 Topics by 1488 members

Installing SilverStripe

SilverStripe Forums » Installing SilverStripe » Symlinking the Framework and MAYBE the CMS

Getting SilverStripe up and running on your computer and on your web server.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 594 Views
  • stefant42
    Avatar
    Community Member
    14 Posts

    Symlinking the Framework and MAYBE the CMS Link to this post

    Dear SS Team,

    nice to use your Framework and CMS. But it will be much more efficenity if we could use onle ONE "framework" and "cms" codebase. SS doesnt allow to symlink both folders in a Project. So every time a need to copy and maintain 50MB of the same files in each Project.

    Is it so hard to use a alternative include and require strategy to solve that Problem??!!

    Hope you will answer to this Topic.

    -Stefan

  • Willr
    Avatar
    Forum Moderator
    5497 Posts

    Re: Symlinking the Framework and MAYBE the CMS Link to this post

    You should be able to symlink cms, framework fine. Though each of your sites will need to define a TEMP_FOLDER const in the _config.php

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Symlinking the Framework and MAYBE the CMS Link to this post

    Adding the TEMP_FOLDER constant to _config.php seems to be too late in the startup-process. I had to add it to _ss_environment.php to make it work. Eg.

    if(!defined(TEMP_FOLDER)){
       define('TEMP_FOLDER', realpath('tmp'));
    }

    When a folder called tmp is in the same directory structure (eg. webroot) as the _ss_environment.php file.

    There's another issue though: If you don't serve pages via index.php, the BASE_PATH will be wrong and Core.php will search for a _ss_environment.php file in the real location of the framework folder (not the symlinked framework folder).

    Adding the following lines to an _ss_environment.php file in the same folder as the real framework folder correctly sets the base-path

    // make BASE_PATH point to the directory where the symlinked framework folder resides!
    define('BASE_PATH', rtrim(dirname(dirname($_SERVER['SCRIPT_FILENAME'])), DIRECTORY_SEPARATOR));
    // set temp folder accordingly
    define('TEMP_FOLDER', BASE_PATH . DIRECTORY_SEPARATOR . 'tmp');

    The code above fixes all issues I had with symlinking the framework and cms folders to several sites.

    594 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.