| re: Hiding a PHP app behind a symlink?
"Patrick Lioi" wrote...
*SNIPPED*
[color=blue]
> I want code in /DOCROOT/MyCMS/ to be able to
> require_once("../config.php"). But I'm new to symlinks, and a little
> testing has shown me that unix command ls seems to disagree with
> itself about how to follow symlinks "backwards". Do I need to take any
> special action to make require_once() follow the symlink "back" to the
> proper /DOCROOT/siteN/ directory?[/color]
Make all your symlinks absolute, not relative and you should be fine :-)
ie,
ln -s /abs/path/to/file /abs/path/to/symlink
That will get around the problem of having relative symlinks failing but it
could make you symlinks a few bytes longer - considering symlinks are
usually much smaller than the files you're linking this shouldn't be a
problem. But I gather the main aim here is to only have to edit a single
instance of the core "library" functions etc for each site, in which case
yes, symlinks are the way to go.
If all else fails, and the libraries and sites are all on the same file
system you could use hard-links (ln without the -s). These are a bitch to
clean up though coz they "look" like regular files, but are actually
referencing the same inode (hard to track down all the hard links etc).
"man ln" is your friend :-)
-- James
_______________________________________
A random quote of nothing:
"... I should explain that I was wearing a black velvet cape that was
supposed to make me look like the dashing, romantic Zorro but which
actually made me look like a gigantic bat wearing glasses ..."
-- Dave Barry, "The Wet Zorro Suit and Other Turning
Points in l'Amour" |