I want to host multiple Symfony2 based websites under one root (server). Would it be possible to share the symfony own files? (vendors etc.). Does someone know a tutorial? Is it hard to manage? AFAIK a Symfony installation has about 600MB and I don't want to save this in a redundant manner ..
Asked
Active
Viewed 3,823 times
2 Answers
11
I certainly looks possible. A few things to remember:
- The
Symfony/vendors
folder contains all the Symfony related code. This can easily be shared between applications. - The
Symfony/app
folder contains application related files like the config and cache, and shouldn't be shared between applications. - The
Symfony/web
folder contains the public folder from which the application will be served, and shouldn't be shared. - The
Symfony/src
folder contains your bundles, and can be shared, depending on your needs
So at the very least, do the following:
- Make copies of the
web
andapp
folders. Keep the copies in theSymfony
folder. AFAIK, there's no easy way to have these folders in different locations. - In the new
app
folder, edit bothapp.php
andapp_dev.php
. Replace all references to theapp
folder with the name of your new / second app folder. - Run
php newapp/console assets:install newapp
on your command line to install the bundled assets.
I'm sure you can also copy the src
folder, although I haven't experimented with that. Reusing your bundles is probably a good idea in any way.

Jrgns
- 24,699
- 18
- 71
- 77
-
see [resolved - multiple websites on the same symfony2 base?](http://forum.symfony-project.org/viewtopic.php?f=11&t=37166#p123723) – Dvir Berebi Jan 23 '12 at 11:32
0
Are you talking about the framework ? If yes, you just can move the folder anywhere on your server (let's say '/usr/local/symfony') and from your sites, just load the autoloader from this directory.
Check out this page of the documentation for more info (in the "Installation Verification" part).
If you want to use the same application for all your websites, it has to be design for that...

Benjamin Dubois
- 971
- 7
- 11
-
yes, I am talking about the framework, but your link is about a previous version and AFAIK the new version is quite different (ordner structure and so on).. – NaN Jul 31 '11 at 08:34
-
Oops, didn't see that... Sorry ! I tried to look around, but there seem to be no documented way to do this yet. – Benjamin Dubois Jul 31 '11 at 08:46