I am going to have a number of separate sites - let's call them example1.com, example2.com, example1000.com and so on.
Each of these sites will have the same overall structure with separate directories for images, pdfs, includes, plots, furum, gallery etc.
Most of the files in all of the sites will be common except for most files in images and pdfs and a small number of the other files.
There will be a few cases where a slightly modified version of a file will be needed for one site.
Some of the code being used for generating pdfs and graphs and for the gallery are open source scripts where I need to be able to update the script when a new version is released so updating the PHP in all the scripts is not an option (besides which there are hundreds of files that would need changing even if this were an option).
What I would like to do is to place all of the common files in one location where there is only the one copy to maintain.and have all of the sites grab the common copy of the file if a specific version doesn't exist for that particular site.
How can I set up a separate directory (outside of public_html) that contains all of the common files using the same directory structure as all of the sites will use and then have all of the sites retrieve files from this directory or appropriate sub-directory when a corresponding file for that particular domain doesn't exist. In most cases the common PHP will need to get at least one of the include files from the original domain.
Basically I want all of the domains to behave as if all of the files in this external directory were in the corresponding spot within that domain's directory except where it has been overridden by a correspondingly named file already in that directory - without actually copying all of the files across.