Hello Vinny,

Tuesday, February 10, 2004, 6:18:09 AM, you wrote:

V> [doc root]
V> -----[php]
V> ---------- script.php
V> ---------- [some folder]
V> --------------- [another folder]
V> -------------------- current.php

V> So my question is, is this simply a PHP config problem?

Nope. Nothing to do with Apache either. The problem is that you're
assuming the include function knows what your doc root is. But think
about it - how can it? It's looking for files on a FILESYSTEM level,
not a URL level.

Assume the following is the actual directory structure on your server:

/usr                        <-- Top Level
/usr/home
/usr/home/vinny
/usr/home/vinny/public_html <-- Where your web files live

Say you want current.php to include "script.php" as in your example.
You have two choices:

include "../../script.php";

Which as you pointed out isn't ideal if you ever need to move around.
Alternatively:

include "/usr/home/vinny/public_html/php/script.php";

Which will never fail as long as you never move script.php

Why not set-up a variable in a common include file (something like
$basedir = "/usr/home/vinny/public_html/php") and then you can just do
this:

include "$basedir/script.php";

Or whatever you need to do.

The other solution would be to place your local (home) directory into
the search path for include in the php.ini file.

-- 
Best regards,
 Richard                            mailto:[EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to