ID: 14797
Comment by: [EMAIL PROTECTED]
Old Reported By: [EMAIL PROTECTED]
Reported By: [EMAIL PROTECTED]
Status: Open
Bug Type: Scripting Engine problem
Operating System: Windows 98 SE
PHP Version: 4.1.0
New Comment:

We're getting hit by this too. Funny how because the local dev box is
windows xp we can't use include_path for a unix main server! :(.

Anyway, I tried the idea of using C:\apache/htdocs as the DocumentRoot,
and Apache stopped reading .htaccess files completely, rendering the
workaround useless. This is a major issue for us, I'm having to scream
for a local unix dev box...


Previous Comments:
------------------------------------------------------------------------

[2002-01-17 11:11:47] [EMAIL PROTECTED]

How about 

include(getenv("DRIVELETTER")."/foo/test.php");

and setting this environment variable locally (chances are it isn't set
on the real webserver).

Cheerio, Marc.

------------------------------------------------------------------------

[2002-01-17 10:56:50] [EMAIL PROTECTED]

OK, I think I has to use this workaround:

if (strpos($SERVER_SOFTWARE, "Win")) { // Windows - Is there a better
way to detect this?
    $NB_INCLUDE_PATH_PREFIX = substr($DOCUMENT_ROOT, 0, 2); // The
drive letter - Is there a better way to detect this?
} else { // NOT Windows
    $NB_INCLUDE_PATH_PREFIX = "";
}

include ($NB_INCLUDE_PATH_PREFIX . "/foo/test.php");

But I'm not really happy...

------------------------------------------------------------------------

[2002-01-17 10:35:01] [EMAIL PROTECTED]

Yes,  but  I  do not want to edit anything. I want to upload the files
and then it has to work.

Perhaps you can use something like this:

if (strpos($SERVER_SOFTWARE, "Win")) {
    echo "<font color=\"#FF0000\">WINDOWS</font>";
} else {
    echo "<font color=\"#008000\">Uhh, good...</font>";
}

But it's only a dirty workaround.

------------------------------------------------------------------------

[2002-01-17 10:19:11] [EMAIL PROTECTED]


I use NT, but that doesn't really matter. What works for me is the
following:

If in httpd.conf, the DocumentRoot is d:/foo/htdocs, then
in php.ini, I set include_path to d:/foo/htdocs as well.

In every script that uses include, specify the relative path from
d:/foo/htdocs (never from the current file!), _without_ a leading /,
e.g. if your include file is d:/foo/htdocs/inc/bla.p, then use
include("inc/bla.p");

You could combine this with tricks like defining a constant
ABS_INCL_PATH, setting this to d:/foo/htdocs and then using
include(ABS_INCL_PATH."/inc/bla.p");

This way you can also create more constants, like
THIS_PROJECT_ABS_INCL_PATH and GENERAL_TOOLBOX_ABS_INCL_PATH.

Switching to a *nix environment is just a matter of redefining your
constants.

Hope this helps, Marc.

------------------------------------------------------------------------

[2002-01-17 10:02:58] [EMAIL PROTECTED]

Hello,

I tried:

DocumentRoot "d:/foo/htdocs"

DocumentRoot "d:/foo/htdocs/"

DocumentRoot "d:\foo/htdocs"

DocumentRoot "d:\foo/htdocs/"

I used 'php.ini-dist' with include_path set to ".".

Nevertheless,  I can't include files with an absolute path. Statements
with a relative path work properly.

Regards,

Martin


------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/?id=14797


Edit this bug report at http://bugs.php.net/?id=14797&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to