Re: fopen and paths
| From: | David Robley | Date: | Wed, 14 Nov 2001 01:37:10 +0000 |
| Subject: | Re: fopen and paths | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-74519@lists.php.net to get a copy of this message | ||
On Tue, 13 Nov 2001 22:28, PACKER, Steffan wrote:
> Thanks but I am still having problems, $DOCUMENT_ROOT does not seem to
> work(I am using an NT4 server), I cannot use an absolute path as the
> content management software that is running has a tendency to strip
> them out!
>
> It seems (to me) that it is a precedence problem, as it does not look
> in the include_path first to see if the file exists but simply creates
> it in the active documents directory.
>
> Any ideas would be appreciated!
>
> Steffan
>
>
> -----Original Message-----
> From: David Robley [mailto:huntsman@www.nisu.flinders.edu.au]
> Sent: Tuesday, November 13, 2001 3:22 AM
> To: PACKER, Steffan; 'php-general@lists.php.net'
> Subject: Re: [PHP] fopen and paths
>
> On Tue, 13 Nov 2001 03:14, PACKER, Steffan wrote:
> > I am trying to log particular information in an access log and I need
> > it to be used on several pages all in different directories, I would
> > like the actual log to be stored in a directory called data in the
> > root directory of my web page. I using an include() on each page
> > where I would like the info logged.
> > I am using:
> > $log_fp = fopen("../data/access_log.txt", "a",1);
> > with the use_include_path set to 1.
> >
> > My problem is that a new file is being created in each directory that
> > the logging.inc file is added to.
> >
> > Can anyone help?
> > Steffan
>
> ../data/access_log.txt seems to be a relative address to me, pointing
> to the directory data which hangs off the parent of the current
> directory.
>
> Why not give full path information, so there is no ambiguity? Or use
> $DOCUMENT_ROOT for portability?
Well, what exactly is your include_path setting? $DOCUMENT_ROOT certainly
works on a W98, I'll just fire up an NT4 w/station here and see.... Works
a treat there. Are you by chance running php as a cgi - that may have a
bearing? See what phpinfo has to say.
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Help! I'm trapped in a Chinese computer factory!