I have an annoying include problem. I have three web sites in adjacent dirs:
/www
/dev
/3p
www is the main web site, dev contains a development version of the same, and 3p relies on some functionality provided within
www. My include_path is '.:./includes:/www/include
s'. That last path is provided so that the 3p site gets access to the current versions of stuff deployed in
www. www and dev each contain their own specific config file that lives in ./include along with the core classes for the site.
Each site's include folder may include further stuff in ./includes/libs, One such file, say /dev/includes/lib/aclass.p
hp, does a require_once 'some_core.class.php', which is a core class for the site and lives in /dev/includes. When run inside dev, this will actually pull /www/includes/some_core.cl
ass.php instead of the desired /dev/includes/some_core.cl
ass.php because that's where it will find it due to the include_path. When the same include is called from 3p, it correctly pulls the version from
www. The problem I'm having is how to maintain the main site and other sites that depend on it while still being able to get the dev site to act independently.
So, can anyone come up with a scheme for including files (in an elegant, general way, realising that this is actually on a much larger scale!) to make it find the one in /dev instead? I've tried all kinds of things but I seem to be having a spot of brain fade... I can't put /dev/includes in the include_path as then 3p will pick it up in preference to /
www. Anything involving absolute paths (the same code must run on multiple servers with differing configs) or .. is generally a bad idea!
Start Free Trial