Seth Foss wrote: > Jim Lucas wrote: >> Seth Foss wrote: >> >>> Hi everyone, >>> >>> I am trying to run multiple sites on the same server, that have mostly >>> identical code - a pre-built application. >>> >>> Anyway, I would like to save disk space by specifying independent >>> configuration files for each site, then using symbolic links to access >>> the rest of the code for the application. >>> >>> I have managed to configure apache so one such directory is accessed via >>> a symlink, which is ok. However, a file within the linked directory >>> attempts to include the configuration file (../config.php) from the >>> actual parent directory instead of the directory containing the symlink. >>> >>> Is there any way to configure apache or php to trace back the symlink >>> when using '..', or can that only go one direction? >>> >>> Thanks, >>> Seth >>> >>> >> >> You can set the include path for your code to include the parent >> directory >> from where the symlink is and then remove the ../ part of the call. >> >> > Jim, > > I had considered that, but I plan to have multiple directories following > symlinks to the same place. > > For example, > > /var/www/site1 has a config.php and a symlink to var/www/universal/app > while > /var/www/site2 has a different config.php and a symlink to > var/www/universal/app > > var/www/universal/app has an index.php with include(../config.php) that > needs the config from the site that is using it (i.e., sometimes site1, > sometimes site2) > > Does that make sense? Or did I misunderstand your suggestion? > > Thanks, > Seth > > You might have miss understood me. In your VHOST entries, make an entry on each domain <VirtualHost X.X.X.X> DocumentRoot /path/to/example.com/public_html ServerName example.com php_value include_path '/path/to/example.com/public_html </VirtualHost> Now you have your app symlinked into the public_html dir as such (guessing here) ln -s /path/to/my/app /path/to/example.com/public_html/app Now, in the app directory you have index.php that has include '../config.php'; Your problem is that the ../config.php reference refers to /path/to/my/app/../config.php == /path/to/my/ instead of /path/to/example.com/public_html/app/../config.php Correct??? This is because it is being referenced logically from /path/to/my/app/index.php any symbolically from /path/to/example.com/public_html/app/index.php If that is the case, add the vHOST entry that I talked about above, then reference the config file as include 'config.php'; and it will then look in the include_path location(s) for the files and not think of referencing the current directory that it is in. Mind you that you can also enter this information into a .htaccess that is located in the /path/to/example.com/public_html/ directory. As long as .htaccess files are allowed. I usually have my include_path set to ".:/path/to/example.com/public_html/" in my vhosts entry for each domain. Hope this helps -- Jim Lucas "Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them." Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php