path specification on Windows Servers

For many web sites hosted on Unix servers I use (happily) a
construction like this for includes:

<?php include ($_SERVER['DOCUMENT_ROOT'].'/includes/footer.inc');
?>

But this does not work on Windows servers and it has always been
a puzzle to me (yes, I have asked here and elsewhere before about
the matter. I seem not to have appreciated any advice given, or I
have forgotten it). Anyone know a reliable way to state the path
absolutely on a Windows server so I can use the same construction
on each page with assurance the server can find the folder which
contains all the includes?

--
dorayme
dorayme [ So, 17 Juni 2007 08:22 ] [ ID #1740394 ]

Re: path specification on Windows Servers

On Sun, 17 Jun 2007 08:22:52 +0200, dorayme
<doraymeRidThis [at] optusnet.com.au> wrote:

> For many web sites hosted on Unix servers I use (happily) a
> construction like this for includes:
>
> <?php include ($_SERVER['DOCUMENT_ROOT'].'/includes/footer.inc');
> ?>
>
> But this does not work on Windows servers and it has always been
> a puzzle to me (yes, I have asked here and elsewhere before about
> the matter. I seem not to have appreciated any advice given, or I
> have forgotten it). Anyone know a reliable way to state the path
> absolutely on a Windows server so I can use the same construction
> on each page with assurance the server can find the folder which
> contains all the includes?


It works on Windows for me, with Apache though. On another webserver it
might be diffent. print_r($_SERVER) to see what data it holds, if that
doesn't work, I've had good luck with getenv('DOCUMENT_ROOT').

--
Rik Wasmus
luiheidsgoeroe [ So, 17 Juni 2007 15:20 ] [ ID #1740399 ]

Re: path specification on Windows Servers

In article <op.tt2h06ibqnv3q9 [at] metallium>,
Rik <luiheidsgoeroe [at] hotmail.com> wrote:

> On Sun, 17 Jun 2007 08:22:52 +0200, dorayme
> <doraymeRidThis [at] optusnet.com.au> wrote:
>
> > For many web sites hosted on Unix servers I use (happily) a
> > construction like this for includes:
> >
> > <?php include ($_SERVER['DOCUMENT_ROOT'].'/includes/footer.inc');
> > ?>
> >
> > But this does not work on Windows servers and it has always been
> > a puzzle to me (yes, I have asked here and elsewhere before about
> > the matter. I seem not to have appreciated any advice given, or I
> > have forgotten it). Anyone know a reliable way to state the path
> > absolutely on a Windows server so I can use the same construction
> > on each page with assurance the server can find the folder which
> > contains all the includes?
>
>
> It works on Windows for me, with Apache though. On another webserver it
> might be diffent. print_r($_SERVER) to see what data it holds, if that
> doesn't work, I've had good luck with getenv('DOCUMENT_ROOT').

Thanks but I seem not to be getting anywhere (perhaps I am
destined to put in paths tailored to the particular html files
and directories concerned; easy work but a tad inelegant!).

<?php
echo ini_get('include_path');
?>

(as per a suggestion from another ng) got me:

..;e:\php

but I have no clue what to do with it, to be honest.

--
dorayme
dorayme [ Mo, 18 Juni 2007 05:01 ] [ ID #1741186 ]

Re: path specification on Windows Servers

In article <op.tt2h06ibqnv3q9 [at] metallium>,
Rik <luiheidsgoeroe [at] hotmail.com> wrote:

> On Sun, 17 Jun 2007 08:22:52 +0200, dorayme
> <doraymeRidThis [at] optusnet.com.au> wrote:
>
> > For many web sites hosted on Unix servers I use (happily) a
> > construction like this for includes:
> >
> > <?php include ($_SERVER['DOCUMENT_ROOT'].'/includes/footer.inc');
> > ?>
> >
> > But this does not work on Windows servers and it has always been
> > a puzzle to me (yes, I have asked here and elsewhere before about
> > the matter. I seem not to have appreciated any advice given, or I
> > have forgotten it). Anyone know a reliable way to state the path
> > absolutely on a Windows server so I can use the same construction
> > on each page with assurance the server can find the folder which
> > contains all the includes?
>
>
> It works on Windows for me, with Apache though. On another webserver it
> might be diffent. print_r($_SERVER) to see what data it holds, if that
> doesn't work, I've had good luck with getenv('DOCUMENT_ROOT').

Finally got it to work after guidance from someone on alt.html
where I asked similar question. He suggested some code to winkle
out the path and it came up trumps and well, I am away on this
one at last. Thought I should mention it in case anyone else has
had similar problem:

<http://groups.google.com.au/group/alt.html/browse_frm/thread/dd92
89787fb6504e/20d4081545e64238?lnk=raot&hl=en#20d4081545e6423 8>

--
dorayme
dorayme [ Di, 19 Juni 2007 05:00 ] [ ID #1742052 ]
PHP » alt.php » path specification on Windows Servers

Vorheriges Thema: Spell Checker w/PHP
Nächstes Thema: php MySQL about 40 work hours. Anywhere