[LAMP]Best location for include file

LotsOfZeros

^^^ Bi-Winning ^^^
Feb 9, 2008
4,649
118
0
www.makemoniesonline.com
Is there a 'best practice' location to place an include file that will be accessed by multiple domains on the same server? For example I noticed while using Smarty they recommended:

// put full path to Smarty.class.php
require('/usr/local/lib/php/Smarty/Smarty.class.php');

My question isn't Smarty related, I was just using this as an example.
I basically have an idea I want to implement where I could make changes across multiple domains (hosted on the same server for hosting customers) or possibly have multiple domains access the same database, etc so security would be an issue (such as a config.php file).
 


You could if running your own server under the same owner, but in the case of smarty you'll want to make sure to either setup separate configuration variables such as compile/cache directories or at the very least different tokens (as per example of something keep in mind). However in other environments such as shared hosting what you suggest may not be easily feasible, especially if each user has their own locked home directory which is typical of a cpanel/whm setup.

I would say if you're hoping to do this for clients, then simply keep client files within the client home directory, it'll be safter and easier that way.
 
Sorry I wasn't more transparent. I have root access to an apache (CentOS) VPS on this.
I want to be able to have multiple directories config access to write to the same database on the same server.
Think a lead generating company with the following domains all sending leads to the same database:
insuranceleads.com
roofingleads.com
landscapeleads.com
mortgageleads.com
etc....
you get the idea.

P.S. when using Smarty, each cache, template directory may be in each domain's directory root:
domain.com/smarty/cache
domain.com/smarty/template
but the Smarty class is all pointing to the same location on the server (why dupe this for every domain?):
/usr/local/lib/php/Smarty/Smarty.class.php
 
If all the accounts/domains are owned by roots, then yes it wouldn't be problematic to consolidate commonly used libraries between the domains. I only mentioned duplicating it, if each of the domains were per se different clients/users, because then that would negate security between users and possibly the system itself.

Far as the smarty example goes you mainly just want to make sure that there's a seperate compile/cache directory for each instance (or a custom prefix) because otherwise one version of index.php could be overwritten by another in the cache and you'd have a mess of the outputs.
 
Pretty much what I want to do. I get a server (VPS or Dedi) and set up my main domain which we will call "LeadGenDomain.com". Then we will set up other domains (through WHM) on the same server for each of my local leadgen clients (MrLocalMortgageGuy.com, InsuranceGuy.com, RooferClient.com) each with their own pretty LP.

Each owner of the leadgen clients domains have capture pages that feed leads to one database - when each owner of the leadgen sites log into LeadGenDomain.com/myCRM.php it all aggregates together

each site will have their own templates/cache in their own public_html directory but if they share the same database or other fuctionality, I would like the option of managing it from one central point of reference.

I suppose my question is more of a compatibility/access rights area for the most part.
Just so it all works.