#30059 [Opn->Bgs]: $_SERVER[SystemRoot] is empty
| From: | derick@php.net | Date: | Sat, 11 Sep 2004 13:21:56 +0000 |
| Subject: | #30059 [Opn->Bgs]: $_SERVER[SystemRoot] is empty | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-66057@lists.php.net to get a copy of this message | ||
ID: 30059
Updated by: derick@php.net
Reported By: rograham at compuserve dot com
-Status: Open
+Status: Bogus
Bug Type: Variables related
Operating System: Windows 2000
PHP Version: 4.3.8
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Previous Comments:
------------------------------------------------------------------------
[2004-09-11 00:22:18] rograham at compuserve dot com
OK. It is making more sense now since I have been
using the php.ini-recommended version which has:
register_globals = off
variables_order = "GPCS"
So (as the comments clearly say), in order to access
environment variables, you can (MUST) use getenv() instead.
The $HTTP_ENV_VARS and $_ENV arrays remain empty.
------------------------------------------------------------------------
[2004-09-10 23:27:04] rograham at compuserve dot com
Description:
------------
phpinfo() indicates correct SystemRoot value
for Environment (in my case D:\WINNT)
but $_SERVER[SystemRoot] and $_ENV[SystemRoot]
both return empty.
vardump of $GLOBALS shows:
["HTTP_SERVER_VARS"]=> array(34) {...}
["_SERVER"]=> array(34) {...}
["HTTP_ENV_VARS"]=>array(0) {}
["_ENV"]=> array(0) {}
This may be "working as designed", but it appears
that the whole issue of global variables registration
has altered things.
See below post for SugarCRM which uses JPGraph
which relied upon [SystemRoot] values.
VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Using PHP 4.3.8 and IIS 5.0 (isapi) and JPGraph 1.1.6 (or JPGraph
1.1.5)
Problem in jpgraph.php for the path definition of the Font directory
(and Cache as well) for Windows systems.
JPGraph presumes that $_SERVER[SystemRoot] is a valid PHP predefined
variable (it isn't). JPGraph 1.1.5 similarly used $_ENV[SystemRoot].
While trying to solve this problem, I upgraded to JPGraph 1.1.6 because
I could see from other posts that there were some problems caused by PHP
variable registration policies.
THIS MAY JUST BE TRUE FOR ISAPI but the current PHP manual does not
list "SystemRoot" as a valid $_SYSTEM variable. A key aspect of $_ENV
variables is that they are diversely popluated by different
environments, so this might have worked in the past for prior
versions.
It is odd, because phpinfo() does list the "SystemRoot" value
(correctly).
Each jpgraph.php script actually dies because the
$_SYSTEM[SystemRoot]value is empty. You don't see the die
message...which was obsolete anyways.
Of course you don't see the graph either.
Easy solution (so far) is to update jpg-config.inc in the jpgraph/src
subdirectory to explicitly:
DEFINE("TTF_DIR","yoursystemroot/FONTS/");
Mine is now:
DEFINE("TTF_DIR","D:/WINNT/FONTS/");
The defective code is bypassed if the path is predefined this way.
Now I get the pretty graphs in SugarSales!!
Will contact JPGraph to update/correct their code/guidance.
Will also post to PHP for documentation.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30059&edit=1