I've built an application in PHP that operates on a SaaS multi-tenant architecture. Until now I have a configuration table that has approximately 20 columns - it stores variables such as the language, name, css file location, custom URL and favicon/logo name for each SaaS instance which is then SELECTed as an array in the config file. The config file is included into all scripts and pages.
There has to be a better way to store these variables making them available to the app rather than select 20+ records from a table, set them as variables, using them during the compliation of the PHP script and deliver them to the user. This is adding far more load to my MySQL server than necessary and I dare say it's probably challenging Apache2, too.
What is a good method of achieving this goal? Cookie? Session? XML file?
I'm storing my PHP session ID's in the database and have considered collecting the variables when a user logs in and adding them to a plain text or XML file with the same session ID in the file name. I can then have a cronjob that runs garbage collection on the config files (look for file name X in database and if not found unlink X, in its simplest form).
At the moment, I'm thinking either a cookie or creating a file with the session id containing the values. Either option will remove the need to collect these database values and set them as variables on every page load.
Thoughts and suggestions?
Thank you, Michael