Forum Moderators: coopster
The problem with a config file for each webhost is that I can not just run all webhosts off the same code-base.
What is the best way to detect which webhost the CMS is running on?
I was sort of thinking along the lines of:
If SERVER_NAME = a and IP = b THEN WEB_HOST = localhost
If SERVER_NAME = c and IP = d THEN WEB_HOST = x
If SERVER_NAME = e and IP = f THEN WEB_HOST = y
If SERVER_NAME = g and IP = h THEN WEB_HOST = z
I would then load the config file for WEB_HOST.
The problem with this is that I know IP addresses will change and break it all so that is not a good idea. I am not sure how often SERVER_NAME might change.
Any ideas?
...or most hosts use a different directory structure.
Use $_SERVER['DOCUMENT_ROOT'] to test the directory structure. If each is unique you could use this.
...or use $_SERVER['SERVER_NAME'](aka mydomain.com)...you gotta know which host serves which site (not completely true). Then just check against an array in a config file or something to see how to connect.