Debian Bug report logs - #492739
$_SERVER['PATH_TRANSLATED'] does not more work

version graph

Package: php5; Maintainer for php5 is (unknown);

Reported by: Michelle Konzack <linux4michelle@tamay-dogan.net>

Date: Mon, 28 Jul 2008 14:51:16 UTC

Severity: normal

Found in version php5/5.2.0-8+etch10

Done: Thijs Kinkhorst <thijs@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#492739; Package php5. (full text, mbox, link).


Acknowledgement sent to Michelle Konzack <linux4michelle@tamay-dogan.net>:
New Bug report received and forwarded. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (full text, mbox, link).


Message #5 received at submit@bugs.debian.org (full text, mbox, reply):

From: Michelle Konzack <linux4michelle@tamay-dogan.net>
To: BTS <submit@bugs.debian.org>
Subject: $_SERVER['PATH_TRANSLATED'] does not more work
Date: Mon, 28 Jul 2008 09:53:24 +0200
[Message part 1 (text/plain, inline)]
Package: php5
Version: 5.2.0-8+etch10
Severity: important

Hello Maintainer,

while under Sarge with  php4  $_SERVER['PATH_TRANSLATED']  was  working
properly and also under php5 on the Gentoo VHost of my ISP, but it does
not work on my recently installed Etch Server @home.

My whole site with all its nearly 200 VHosts is ONLY a singel /index.php
and the contents is generated based on $_SERVER['SERVER_NAME'] but since
I need the physical path, my website is entirely broken.

Note:   The path to the /index.php is
            /var/www/customers/konzack/sites/index.php
        and $_SERVER['PATH_TRANSLATED'] returns "/" which is wrong.

Please can you look at it?

The code sniplet from the beginning of the /index.php is:

----[ '/var/www/customers/konzack/sites/index.php' ]--------------------
<?php

$MY_PATH=dirname(dirname($_SERVER["PATH_TRANSLATED"]));

$MY_CONFIG="$MY_PATH/HOST_" . $_SERVER["HTTP_HOST"];

if ( is_file($MY_CONFIG) ) {
  include $MY_CONFIG;
} else {
  header("Content-Type: text/plain");
  die("Config for host \"$_SERVER[HTTP_HOST]\" not found.\n($MY_CONFIG)");
}
<snip>
------------------------------------------------------------------------

And currently I have hardcoded the $MY_PATH which  is  not  the  optimal
solution since it can be forgotten.

Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator
    24V Electronic Engineer
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
+49/177/9351947    50, rue de Soultz         MSN LinuxMichi
+33/6/61925193     67100 Strasbourg/France   IRC #Debian (irc.icq.com)
[signature.pgp (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#492739; Package php5. (full text, mbox, link).


Acknowledgement sent to "Ondřej Surý" <ondrej@sury.org>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (full text, mbox, link).


Message #10 received at 492739@bugs.debian.org (full text, mbox, reply):

From: "Ondřej Surý" <ondrej@sury.org>
To: "Michelle Konzack" <linux4michelle@tamay-dogan.net>, 492739@bugs.debian.org, control@bugs.debian.org
Subject: Re: [php-maint] Bug#492739: $_SERVER['PATH_TRANSLATED'] does not more work
Date: Mon, 28 Jul 2008 16:07:27 +0100
severity 492739 normal
thank you

From http://us2.php.net/manual/en/reserved.variables.server.php:

"""    Note:  As of PHP 4.3.2, PATH_TRANSLATED is no longer set
implicitly under the Apache 2 SAPI in contrast to the situation in
Apache 1, where it's set to the same value as the SCRIPT_FILENAME
server variable when it's not populated by Apache. This change was
made to comply with the CGI specification that PATH_TRANSLATED should
only exist if PATH_INFO is defined.   Apache 2 users may use
AcceptPathInfo = On inside httpd.conf to define PATH_INFO.  """

So did you do your homework properly before filling this bug report
and have you read the docs and is PATH_INFO defined in your
environment?

Ondrej.

2008/7/28 Michelle Konzack <linux4michelle@tamay-dogan.net>:
> Package: php5
> Version: 5.2.0-8+etch10
> Severity: important
>
> Hello Maintainer,
>
> while under Sarge with  php4  $_SERVER['PATH_TRANSLATED']  was  working
> properly and also under php5 on the Gentoo VHost of my ISP, but it does
> not work on my recently installed Etch Server @home.
>
> My whole site with all its nearly 200 VHosts is ONLY a singel /index.php
> and the contents is generated based on $_SERVER['SERVER_NAME'] but since
> I need the physical path, my website is entirely broken.
>
> Note:   The path to the /index.php is
>            /var/www/customers/konzack/sites/index.php
>        and $_SERVER['PATH_TRANSLATED'] returns "/" which is wrong.
>
> Please can you look at it?
>
> The code sniplet from the beginning of the /index.php is:
>
> ----[ '/var/www/customers/konzack/sites/index.php' ]--------------------
> <?php
>
> $MY_PATH=dirname(dirname($_SERVER["PATH_TRANSLATED"]));
>
> $MY_CONFIG="$MY_PATH/HOST_" . $_SERVER["HTTP_HOST"];
>
> if ( is_file($MY_CONFIG) ) {
>  include $MY_CONFIG;
> } else {
>  header("Content-Type: text/plain");
>  die("Config for host \"$_SERVER[HTTP_HOST]\" not found.\n($MY_CONFIG)");
> }
> <snip>
> ------------------------------------------------------------------------
>
> And currently I have hardcoded the $MY_PATH which  is  not  the  optimal
> solution since it can be forgotten.
>
> Thanks, Greetings and nice Day/Evening
>    Michelle Konzack
>    Systemadministrator
>    24V Electronic Engineer
>    Tamay Dogan Network
>    Debian GNU/Linux Consultant
>
>
> --
> Linux-User #280138 with the Linux Counter, http://counter.li.org/
> ##################### Debian GNU/Linux Consultant #####################
> Michelle Konzack   Apt. 917                  ICQ #328449886
> +49/177/9351947    50, rue de Soultz         MSN LinuxMichi
> +33/6/61925193     67100 Strasbourg/France   IRC #Debian (irc.icq.com)
>
> _______________________________________________
> pkg-php-maint mailing list
> pkg-php-maint@lists.alioth.debian.org
> http://lists.alioth.debian.org/mailman/listinfo/pkg-php-maint
>



-- 
Ondřej Surý <ondrej@sury.org>

Severity set to `normal' from `important' Request was from "Ondřej Surý" <ondrej@sury.org> to control@bugs.debian.org. (Mon, 28 Jul 2008 15:09:04 GMT) (full text, mbox, link).


Reply sent to Thijs Kinkhorst <thijs@debian.org>:
You have taken responsibility. (full text, mbox, link).


Notification sent to Michelle Konzack <linux4michelle@tamay-dogan.net>:
Bug acknowledged by developer. (full text, mbox, link).


Message #17 received at 492739-done@bugs.debian.org (full text, mbox, reply):

From: Thijs Kinkhorst <thijs@debian.org>
To: Michelle Konzack <linux4michelle@tamay-dogan.net>, 492739-done@bugs.debian.org
Subject: Re: [php-maint] Bug#492739: $_SERVER['PATH_TRANSLATED'] does not more work
Date: Mon, 28 Jul 2008 17:13:31 +0200
[Message part 1 (text/plain, inline)]
On Monday 28 July 2008 09:53, Michelle Konzack wrote:
> Package: php5
> Version: 5.2.0-8+etch10
> Severity: important
>
> Hello Maintainer,
>
> while under Sarge with  php4  $_SERVER['PATH_TRANSLATED']  was  working
> properly and also under php5 on the Gentoo VHost of my ISP, but it does
> not work on my recently installed Etch Server @home.

Thank you for reporting, but I'm afraid that this is not a bug.

It's even documented near the top of the PHP5 migration manual's list of 
incompatible changes:
| * PATH_TRANSLATED server variable is no longer set implicitly under Apache2
| SAPI in contrast to the situation in PHP 4, where it is set to the same
| value as the SCRIPT_FILENAME server variable when it is not populated by
| Apache. This change was made to comply with the » CGI specification. Please
| refer to » bug #23610 for further information, and see also the 
| $_SERVER['PATH_TRANSLATED'] description in the manual. This issue also
| affects PHP versions >= 4.3.2.      


> My whole site with all its nearly 200 VHosts is ONLY a singel /index.php
> and the contents is generated based on $_SERVER['SERVER_NAME'] but since
> I need the physical path, my website is entirely broken.

Use $_SERVER['SCRIPT_NAME']


cheers,
Thijs
[Message part 2 (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#492739; Package php5. (full text, mbox, link).


Acknowledgement sent to Michelle Konzack <linux4michelle@tamay-dogan.net>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (full text, mbox, link).


Message #22 received at 492739@bugs.debian.org (full text, mbox, reply):

From: Michelle Konzack <linux4michelle@tamay-dogan.net>
To: Ond??ej Surý <ondrej@sury.org>, 492739@bugs.debian.org
Subject: Re: Bug#492739: [php-maint] Bug#492739: $_SERVER['PATH_TRANSLATED'] does not more work
Date: Mon, 28 Jul 2008 23:50:04 +0200
[Message part 1 (text/plain, inline)]
Hello Ondrej,

Am 2008-07-28 16:07:27, schrieb Ond??ej Surý:
> From http://us2.php.net/manual/en/reserved.variables.server.php:
> 
> """    Note:  As of PHP 4.3.2, PATH_TRANSLATED is no longer set
> implicitly under the Apache 2 SAPI in contrast to the situation in
> Apache 1, where it's set to the same value as the SCRIPT_FILENAME
> server variable when it's not populated by Apache. This change was
> made to comply with the CGI specification that PATH_TRANSLATED should
> only exist if PATH_INFO is defined.   Apache 2 users may use
> AcceptPathInfo = On inside httpd.conf to define PATH_INFO.  """
> 
> So did you do your homework properly before filling this bug report
> and have you read the docs and is PATH_INFO defined in your
> environment?
> 
> Ondrej.
------------------------ END OF REPLIED MESSAGE ------------------------

OK, my Hosting Provider has set "AcceptPathInfo = On" which was  missing
on my own servers.  ANd yes, I have read the documentation, but updating
over 600 server (from customers) and reading over  3000  pages  documen-
tation for changes between Sarge and Etch is definitivly to much...

Sorry that I have bothered you.

Note:   Interesting is, that my "php5" book is only  speeking  about
        SCRIP_NAME which give under some circumstands weird  results
        while SCRIPT_FILENAME is not mentioned...

Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator
    24V Electronic Engineer
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
+49/177/9351947    50, rue de Soultz         MSN LinuxMichi
+33/6/61925193     67100 Strasbourg/France   IRC #Debian (irc.icq.com)
[signature.pgp (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>:
Bug#492739; Package php5. (full text, mbox, link).


Acknowledgement sent to Michelle Konzack <linux4michelle@tamay-dogan.net>:
Extra info received and forwarded to list. Copy sent to Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>. (full text, mbox, link).


Message #27 received at 492739@bugs.debian.org (full text, mbox, reply):

From: Michelle Konzack <linux4michelle@tamay-dogan.net>
To: Ond??ej Surý <ondrej@sury.org>
Cc: 492739@bugs.debian.org
Subject: Re: [php-maint] Bug#492739: $_SERVER['PATH_TRANSLATED'] does not more work
Date: Wed, 30 Jul 2008 03:31:24 +0200
[Message part 1 (text/plain, inline)]
Hello Ondrej,


Am 2008-07-28 16:07:27, schrieb Ond??ej Surý:
> From http://us2.php.net/manual/en/reserved.variables.server.php:
> 
> """    Note:  As of PHP 4.3.2, PATH_TRANSLATED is no longer set
> implicitly under the Apache 2 SAPI in contrast to the situation in
> Apache 1, where it's set to the same value as the SCRIPT_FILENAME
> server variable when it's not populated by Apache. This change was
> made to comply with the CGI specification that PATH_TRANSLATED should
> only exist if PATH_INFO is defined.   Apache 2 users may use
> AcceptPathInfo = On inside httpd.conf to define PATH_INFO.  """

I have set "AcceptPathInfo On" in my VHost

----[ '/etc/apache2/sites-available/net.tamay-dogan.debian.devel' ]-----
<VirtualHost devel.debian.tamay-dogan.net>
    ServerAdmin         linux4michelle@tamay-dogan.net
    ServerName          devel.debian.tamay-dogan.net

    DocumentRoot        /var/www/net.tamay-dogan.debian.devel/htdocs/
    <Directory />
        Options         FollowSymLinks Indexes
        AllowOverride   None
    </Directory>

    DirectoryIndex      index.php index.html /DirIndex.php
    AcceptPathInfo      On

    ScriptAlias         /cgi-bin/ /var/www/net.tamay-dogan.debian.devel/cgi-bin/
    <Directory "/var/www/net.tamay-dogan.debian.devel/cgi-bin">
        AllowOverride   None
        Options         ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order           allow,deny
        Allow           from all
    </Directory>

    ErrorLog            /var/www/net.tamay-dogan.debian.devel/log/error.log
    LogLevel            warn
    CustomLog           /var/www/net.tamay-dogan.debian.devel/log/access.log com
    ServerSignature     On
</VirtualHost>
----8<------------------------------------------------------------------

and restarted Apache but it does not work.

$_SERVER[PATH_INFO] and $_SERVER[PATH_TRANSLATED] return  empty  strings
and in

    /doc/apache2-doc/manual/mod/core.html#acceptpathinfo

it is written:

----8<------------------------------------------------------------------
This directive controls whether requests that contain trailing pathname
information that follows an actual filename (or non-existent file in an
existing directory) will be accepted or rejected. The trailing pathname
information can be made available to scripts in the PATH_INFO
environment variable.

For example, assume the location /test/ points to a directory that
contains only the single file here.html. Then requests for
/test/here.html/more and /test/nothere.html/more both collect /more as
PATH_INFO.

The three possible arguments for the AcceptPathInfo directive are:

Off    A request will only be accepted if it maps to a literal path that
       exists. Therefore a request with trailing pathname information
       after the true filename such as /test/here.html/more in the above
       example will return a 404 NOT FOUND error.
On     A request will be accepted if a leading path component maps to a
       file that exists. The above example /test/here.html/more will be
        accepted if /test/here.html maps to a valid file.
----8<------------------------------------------------------------------

So why ist the VARIABLE always empty?

For example I have

    DirectoryIndex index.php index.html /DirIndex.php

and if I enter an empty directory like

    /debian-devel/pool/main/

it execute /DirIndex.php and should generate a Directory Listing but:

    PATH_INFO		<empty>
    PATH_TANSLATED	<empty>
    SCRIPT_NAME		/DirIndex.php
    SCRIPT_FILENAME	/var/www/net.tamay-dogan.debian.devel/htdocs/DirIndex.php

But the URL show me /debian-devel/pool/main/

> So did you do your homework properly before filling this bug report
> and have you read the docs and is PATH_INFO defined in your
> environment?

I have read it but nothing is working.  Any hints?

Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator
    24V Electronic Engineer
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
Michelle Konzack   Apt. 917                  ICQ #328449886
+49/177/9351947    50, rue de Soultz         MSN LinuxMichi
+33/6/61925193     67100 Strasbourg/France   IRC #Debian (irc.icq.com)
[signature.pgp (application/pgp-signature, inline)]

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Sat, 30 Aug 2008 07:30:32 GMT) (full text, mbox, link).


Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Jul 2 01:20:41 2023; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.