I am interested to offer both hosted and SaaS version of my application. Now, SOers suggested that I map the URLs to MySQL databases. What I can think of is something like this
- companya.mysoft.com will have the MySQL database that starts with the name companya*. i.e., compana_mydb
- companyb.mysoft.com will have the MySQL database that starts with the name companyb*.i.e., companyb_mydb
- and so on.
In this way it is easier to create new company accounts and doing the maintenance.
Now, is it possible to tweak all these settings inside the Apache configuration files and MySQL ini, and PHP ini files? ( I am using Apache, MySQL and PHP). It's preferable that I don't change my application.
Edit: MySQL doesn't support user-specified database-specific directories. Change the question to reflect this.
Edit2: Some suggested that I edited the PHP application to check for subdomain and select the correct database. But that would mean tweaking the hosting code to meet the SaaS version. So essentially we would have two code versions, one for hosting, another for SaaS, this is not what I desired. It would be better if everything is done through config file so that I would have only one version of code.