Question

I am making a solution in php and am looking at having multiple installs for different clients. If I had 20 databases, is there anything wrong with pointing them to the same php codebase? eg. speed issues, or is it bad practice?

Thanks in advance for your thoughts and expertise :-)

Was it helpful?

Solution

It's possible and won't affect your performance but it has a downside.

If you have one codebase, it means you have to recheck all clients for errors when you update it. Therefor it's better for your clients to have the codebase separated so you can update your codebase for the specific client and prevent errors on other clients.

If everything seems to work for one client, you can consider the same update for another client.

This is the case if you have custom code for every client, if it's one application like a mailmanagement system
it wouldn't be a bad practice at all.

It would be nice tho, if you have assigned a version number to each client. This makes it possible to test a new version on a single client, and slowly migrated other clients to a newer version

OTHER TIPS

I would say the opposite from Visser. If there is a bug in one installation, then the same bug is going to exist in all installations unless you provide customized versions of your software. Sure, different customers might use the applications in different ways, hence some might never experience a defect that brins the business of another customer to a grinding halt. Hence I disagree with Viseer again that it won't affect performance - differences in usage could lead to very marked differences in overall performance for a particular customer, but tuning at the PHP tier will benefit all customers. Tuning at the database tier is a slightly different story - some customers might benefit from an index that would slow down other customers.

If you do provide per-customer variations in the behaviour of your code, then how you do this depends on the complexity of those variations. Ideally the differences should be described in the database, and the same PHP code would then produce different results - e.g. one customer wants a standalone user-management and authentication system, another customer wants to use LDAP authentication, a third OpenID - in which case your code should implement all 3 and the method chosen at runtime based on the data.

Sometimes (but rarely) it's not practical to implement this approach and using different application logic for different installations is the solution. In this case, the right approach is to maintain a fork in your version control system. An example would be different branding on the site - unless you're developing on top of a content management system, then it's probably simpler to use different CSS files (I'm struggling to think of an example where different PHP code is justified).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top