|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24253 $DOCUMENT_ROOT and $PHP_SELF not set (Apache 1.3)
Submitted: 2003-06-19 03:43 UTC Modified: 2003-06-20 12:00 UTC
From: tim at digicol dot de Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.3.3RC1 OS: Red Hat 7.3 (Linux 2.4.18-3)
Private report: No CVE-ID: None
 [2003-06-19 03:43 UTC] tim at digicol dot de
My PHP is compiled statically into Apache 1.3.27:
./configure --with-mysql --with-oracle --with-oci8 --enable-sigchild --with-db3 --with-ldap --with-zlib --with-gd --with-mcrypt=/usr/local/libmcrypt-2.5.7 --with-curl=/usr/local --with-apache=/usr/local/apache_1.3.27

In PHP 4.3.3RC1, the variables $DOCUMENT_ROOT and $PHP_SELF seem to have disappeared completely, even if register_globals is on.

Accessing these variables through $_SERVER or $HTTP_SERVER_VARS works fine.

In PHP 4.3.2 (and - to my knowledge - in all previous 3.x and 4.x versions), $DOCUMENT_ROOT and $PHP_SELF are there as long as register_globals is on.

This breaks backwards compatibility quite awfully. Any chance that this change will be reverted? (If not, please at least make a big note in the NEWS/ChangeLog...)

I'm no C programmer and I don't understand what's going on there, but I saw that php4/main/php_variables.c had been changed...

Reproduce code:
register_globals: "<?=ini_get('register_globals')?>"

Expected result:
register_globals: "1"
$PHP_SELF: "/test.php"
$_SERVER[ PHP_SELF ]: "/test.php"
$DOCUMENT_ROOT: "/home/www"
$_SERVER[ DOCUMENT_ROOT ]: "/home/www"

Actual result:
register_globals: "1"
$_SERVER[ PHP_SELF ]: "/test.php"
$_SERVER[ DOCUMENT_ROOT ]: "/home/www"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-20 12:00 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu May 26 10:05:45 2022 UTC