is it possible to made one installation, and from this installation to make a multiple shops with different databases. Something like I will make one installation on domain.1 with database, and from admin crate new website and store on new database for domain.2. I know this can be made with one database with more multiple store but can it be the same but with different databases.
Great answer slarek. We did something very similar. Instead of editing index.php we setup separate folders outside of magento's codebase, and include mage.php from those folders, and then edit the etc_dir (and other dirs) like in your method above.
Inside each of the client folders are:
...(rest of index.php is business as usual)...
I don't think this is possible out of the box. Magento supports master/slave database configuration, but you have to have them for all the stores.
So depending on the store view you need to know which database to connect to, but in order to know the store view, you need to query a database. So you run around in circles.
You want to have several separate stores with their own databases using single codebase?
Well, there's no simple and recommended way to do that. That being said we can see what CAN be done:
Database information comes from a single xml file: app/etc/local.xml This file is being loaded from app/Mage.php so if you change that file you can theoretically decide which configuration file you're going to load (based on desired condition, such as domain name). Voila, different domain, different database. Now comes the Bad News Part(tm).
What is your main goal? Different admin area or easier handling of your source code?
I would do it with a mix of "local" directories and files and linked (ln -s) common directories and files
/www/common /www/shop1 /www/shop2
But could be a little bit confusing.
You just need to create a new folder to contain the configuration files and in index.php you add an array of options to Mage::Run().
In that folder you'll have all the same content as app/etc/ including the modules folder.
First domain :
Second domain :
this will tell Magento where is the config files for the domain.
i just found this extension: