Bug #14797 Updated: include (_path) in Apache SAPI and CGI on Win98SE does not work

From: Date: Thu, 17 Jan 2002 15:35:02 +0000
Subject: Bug #14797 Updated: include (_path) in Apache SAPI and CGI on Win98SE does not work
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-77343@lists.php.net to get a copy of this message
ID: 14797
User updated by: m@rtin-burger.de
Reported By: m@rtin-burger.de
Status: Open
Bug Type: Scripting Engine problem
Operating System: Windows 98 SE
PHP Version: 4.1.0
New Comment:

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.


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

[2002-01-17 10:19:11] mboeren@php.net


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] m@rtin-burger.de

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


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

[2002-01-15 23:25:31] garth@utmail.to

Oh yeah, the other reason I think it's a bug is because 
the behaviour is not consistant between the CGI version 
and the SAPI version of the same build.

If it has to be inconsistant it should be documented.
(proably a blurb on top of include_path in php.ini would
be the best place for it, since people will find that
include_path causes the problem when their doc_root
is set wrong)

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

[2002-01-15 23:21:44] garth@utmail.to

The Solution:
-------------

You need to add the drive letter as follows

DocumentRoot "D:\apache/htdocs/"
                ^
                | emphasis on the "\"

then relative include_path statements should work.

I still think this is a bug, because apache runs fine
with DocumentRoot "/apache/htdocs/", it's only PHP that
has problems when include_path is set.

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

[2002-01-10 07:36:40] m@rtin-burger.de

Hello,

when   I   add  the  drive  letter  to  the  include  statement  (e.g.
'd:/foo/test.php'), then the inclusion works properly.

But then all scripts only run on a window machine or we have to change
every   script   before   uploading   it   to  our  "real"  webserver,
respectively.

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



Thread (19 messages)

« previous php.dev (#77343) next »