Tugger the SLUGger!SLUG Mailing List Archives

Re: [SLUG] Symlinks and PHP4


Del wrote:
... PHP opens files relative to the currently running script's
location.  If you are running /usr/share/phpapp/myfile.php then
require_once('a.php') will require /usr/share/phpapp/a.php, regardless
of symlinks.

Hmm. I _almost_ get it. You seem to be saying that internally PHP has some kind of "where the hell am I?" function that returns the location of the currently running script, rather than simply taking the file name which you used to invoke the script (in the case of symlinks). That seems counter-intuitive to me.

 And the supplementary question is, how do I get the behaviour I'm after?


require_once($_SERVER["DOCUMENT_ROOT"] . "/config/phpapp.php");

That sounds like the simplest of the options so far.

Thanks to everybody who had a suggestion. They are all filed away for future reference.

You may have more luck getting answers to PHP questions at syd::php
http://sydney.ug.php.net/

I've been trying to avoid considering myself a PHP programmer, feeling that I ought, on some vaguely-defined moral grounds, to prefer the original "P" language, which I have been forgetting and re-learning for years now. But I'm a very reluctant and lazy programmer and damn it, the dark side is easier and more seductive!

Matthew.

--
0419 242 316 ... (02) 6658 1607
--
Please avoid sending me Word or PowerPoint attachments.
(Save as HTML or RTF)
See http://www.fsf.org/philosophy/no-word-attachments.html
--
"Our enemies are innovative and resourceful, and so are we.
They never stop thinking about new ways to harm our people
and our country, and neither do we."
  -- George W. Bush