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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Hosting multiple SilverStripe installations on 1 server

Go to End

7 Posts   2419 Views


Community Member, 31 Posts

6 March 2009 at 11:21pm

Since we shall be hosting multiple SilverStripe sites on 1 server, it makes sense to move all common SilverStripe files to a single location.

Has anybody done this? How did you do it?


Community Member, 473 Posts

7 March 2009 at 7:49am

I have done this by creating symlinks to all the folders that are needed. The only problem with this, is that each installation will need a separate temp folder, either by defining TEMP_FOLDER in a site specific _ss_environment.php file, or by creating a silverstripe-cache folder in each site root. This is because the manifest uses absolute paths, and the absolute path for all the sapphire, cms, jsparty and any linked module would be the same, thus causing conflicts.

You may also need to set Apache up to follow symlinks.


Forum Moderator, 4102 Posts

7 March 2009 at 11:08am

And by all means, update your File.php, Folder.php and GD.php to not use the relative path "/assets".. major problems when you SS install lives above the web root. :)

I host about 15 SS sites on one shared install in /var/ss... works great. All you need is a mysite and assets folder in each vhost.


Community Member, 31 Posts

8 March 2009 at 12:55am

Just found another thread about the same topic:

Re: multisites possible?

UncleCheese, you mentioned you have a script to automatically set-up a new SS site? Can you post the code?

How did you update File.php, Folder.php and GD.php? Did you use the site's physical path?

If I add a silverstripe-cache folder in the virtual host root, will it be automatically detected and used?


Community Member, 31 Posts

8 March 2009 at 1:30am

The problem with the symlinks solution is that it won't work on Windows. That's a real pain since we don't want extra steps after checking out code from subversion. I suppose we'll have to find a work-around for that.


Administrator, 690 Posts

10 March 2009 at 10:22am

Without symlinks it's going to be tricky to do what you're asking. It would be possible, but very difficult, and would require a pretty deep understanding of the core application.

Here's a brief sketch of how to do it:

Let's assume that your site live at c:\inetpub\wwwroot and the silverstripe common files are in c:\inetpub\sscommon

* The manifest builder is going to be amended to index the content of both c:\inetpub\wwwroot and c:\inetpub\sscommon
* Requests for assets that are downloaded directly from the silverstripe common archive are going to need to . This could be done with a rewrite rule that looked to see if the file exists in c:\inetpub\sscommon, and if so, serves that file instead.
* Your base rewriting rule, normally sends everything to sapphire/main.php, will need to be amended to instead send everything to a custom crafted index.php. This index.php will need to manipulate the $_SERVER variables and configure the manifest builder appropriately.
* Most significantly, you would need to review all of the code for direct file access - references to file_exists, fopen, file_get_contents, etc - and change them to be able to deal with the fact that some files are in one folder and some are in another.

To be frank, this isn't an approach that I recommend you take. A much easier approach would be to make a simple script that copied the silverstripe common files from one place into each of your sites.


Community Member, 31 Posts

12 March 2009 at 8:31am

Thanks for the reply Sam.

I see that a lot of work would be envolved in modifying SilverStripe. I think we'll go with your suggestion and make a script to copy the common files.