Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Installing SilverStripe

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

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

Symlinking the Framework and MAYBE the CMS


Reply

3 Posts   622 Views

Avatar
stefant42

8 August 2012 at 2:48am (Last edited: 8 August 2012 2:49am), Community Member, 14 Posts

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

Avatar
Willr

8 August 2012 at 8:38pm Forum Moderator, 5511 Posts

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

Avatar
banal

21 August 2012 at 11:37pm (Last edited: 21 August 2012 11:37pm), Community Member, 901 Posts

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.