RE: [PHP] Re: Difficulty navigating symlinks
| From: | Boyd, Todd M. | Date: | Wed, 22 Oct 2008 21:45:22 +0000 |
| Subject: | RE: [PHP] Re: Difficulty navigating symlinks | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-282299@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Robert Cummings [mailto:robert@interjinn.com]
> Sent: Wednesday, October 22, 2008 3:02 PM
> To: Shawn McKenzie
> Cc: php-general@lists.php.net
> Subject: Re: [PHP] Re: Difficulty navigating symlinks
>
> On Wed, 2008-10-22 at 13:43 -0500, Shawn McKenzie 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
> > Haven't read the entire thread, but you might also look at
> > http://php.net/manual/en/function.realpath.php
>
> realpath() won't help since it will just controbute the same
problem...
> specifically he'll get the path were the page really exists instead of
> the sym'd path which is what he wants.
From www.php.net/realpath :
realpath() expands all symbolic links and resolves references to '/./',
'/../' and extra '/' characters in the input path . and return the
canonicalized absolute pathname.
Sounds like it'll work.
Todd Boyd
Web Programmer