|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-02-24 07:30 UTC] oliver at update dot ch
Description: ------------ The Global Variable $GLOBALS["DOCUMENT_ROOT"] or $DOCUMENT_ROOT is sometimes empty. After a reload $DOCUMENT_ROOT mostly contains the expected value. see also http://bugs.php.net/bug.php?id=25172 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 21:00:01 2025 UTC |
Second try. (If I have to ask these same things for the 3rd time, this bug report will vanish mysteriously..) 1. How did you configure Apache? (configure line used) 2. What MPM are you using with Apache? 3. What is register_globals set to WHEN this happens? (put var_dump(ini_get("register_globals")); in the beginning of your script, see bug #24253 what a nice short test script looks like) 4. Are you sure there aren't any .htaccess files or vhosts setting register_globals to something else? Or setting any other php.ini options? (using php_value, php_admin_value, php_flag or php_admin_flag directives) 5. How was PHP configured into Apache? (as module or CGI binary??)Sorry about that. I'm not the pro on stuff like this. But I try again: Configuration: -------------- './configure' '--with-apxs2=/opt/httpd-2.0.47/bin/apxs' '--with-config-file-path=/etc/httpd2' '--prefix=/opt/ php-4.x' '--enable-versioning' '--with-gd' '--with-jpeg- dir=/usr' '--with-xpm-dir=/usr' '--with-bz2' '--with- freetype-dir=/usr' '--enable-gd-native-ttf' '--enable- debug=no' '--with-exec-dir=/opt/php-4.x/run' '--enable- track-vars=yes' '--disable-cgi' '--enable-calendar' '-- with-ttf' '--with-imap' '--with-ft' '--with-xml' '-- with-mhash' '--with-mcrypt' '--with-bcmath' '--with- snmp' '--enable-ucd-snmp-hack' '--enable-ucd-snmp- compatibility' '--with-pdflib=/opt/pdflib-4.0' '--with- zlib' '--enable-trans-sid' '--with-openssl' '--with- wddx' '--with-crack' '--with-kerberos' '--with-gettext' Reproduce code: --------------- register_globals: "<?=ini_get('register_globals')?>" $GLOBALS["DOCUMENT_ROOT"] = "<? =$GLOBALS["DOCUMENT_ROOT"];?> $DOCUMENT_ROOT: "<?=$DOCUMENT_ROOT?>" $_SERVER["DOCUMENT_ROOT"]: "<?=$_SERVER[ 'DOCUMENT_ROOT' ]?>" Expected result: ---------------- register_globals: "1" $GLOBALS["DOCUMENT_ROOT"] = "/home/www/ $DOCUMENT_ROOT: "/home/www/" $_SERVER["DOCUMENT_ROOT"]: "/home/www/" Result (tested on 02/24/04): -------------- register_globals: "1" $GLOBALS["DOCUMENT_ROOT"] = "" $DOCUMENT_ROOT: "" $_SERVER["DOCUMENT_ROOT"]: "/home/www/" PHP-Version is 4.3.3. The thing is, that I couldn't reproduce the result today (02/25). So I guess, you can really let vanish this report. Thanks for the help anyway.OK, I've got similar but even weirder problem. I just installed the latest production releases of apache2/php and now I occasionally get _wrong_ values in the DOCUMENT_ROOT variable. Instead of containing the pathname of the current virtual host, it sometimes contains the pathname of a different virtual host also configured on this server! There is definitely some problem here, if I click from vhost site to vhost site, I can get these errors repeatedly. Since I'm including files based on the DOCUMENT_ROOT, it manifests itself as an error that looks like this: Warning: main(/home/wrongwebsite/www/includes/functions_generic.php): failed to open stream: No such file or directory in /home/correctwebsite/www/includes/config.php on line 47 In this example its _should_ be including the file functions_generic from "correctwebsite", not "wrongwebsite" After the first instance of this error, it seems to go away until I switch to another website, where it may or may not happen again... FYI, here are the flags set in my virtualhost: php_admin_flag engine on php_admin_flag safe_mode off php_admin_flag register_globals off php_admin_flag display_errors on