Re: Problem with include();
| From: | Curt Zirzow | Date: | Sun, 07 Sep 2003 14:54:09 +0000 |
| Subject: | Re: Problem with include(); | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-161910@lists.php.net to get a copy of this message | ||
* Thus wrote Ty Lamb (Subscriptions@AarynAndTy.com):
> /index.php
> has
> include("/code/includes/page_header.php");
>
> /docs/aaryn/dmb/dave.php
> has
> include("/code/includes/page_header.php");
>
> Both are identical lines of code. Index.php works but dave.php returns the
> following:
>
> Warning: Failed opening '/code/includes/page_header.php' for inclusion
> (include_path='.;c:\php4\pear') in C:\x\x\x\x\x\aaryn\dmb\dave.php on line 4
>
> but if I change the code in dave.php to
> include '../../../code/includes/page_header.php';
ahh.. so your code/ is at your webroot (the same directory as
index.php?) I would have expected the /code to look at
c:\code\includes\page_header.php
But it seems that this isn't the case and I'm not familiar with how
windows handles the absolute path.
>
> It works.
>
> Why?
>
> Is there any way around this? Please tell me I'm doing something wrong and
> it's not supposed to work like this!!!
What I would suggest is to setup your include_path to look
something like:
include_path=".;c:\php4\pear;c:\path\to\code\includes"
Then your include will simply be
include("page_header.php");
Curt
--
"I used to think I was indecisive, but now I'm not so sure."