suPHP and $GLOBALS variable scope

thunn

Verified User
Joined
Mar 13, 2012
Messages
166
Hello,
I'm trying to use $GLOBALS in suPHP but it can't give me data.
Example:
File setData.php
Code:
<?php
$foo = "global VARIABLE";
$GLOBALS["foo"];
print_r($GLOBALS);
?>
Result is:
Array ( [GLOBALS] => Array *RECURSION* [_POST] => Array ( ) [_GET] => Array ( ) [_COOKIE] => Array ( [PHPSESSID] => 2jnfmopbi5h2b8l169svie63b3 [__utma] => 196765739.194337144.1399825592.1404818990.1404840354.13 [__utmc] => 196765739 [__utmz] => 196765739.1399825592.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
[_ga] => GA1.3.194337144.1399825592 ) [_FILES] => Array ( ) [foo] => global VARIABLE )


File getData.php
Code:
<?php
$GLOBALS["foo"];
print_r($GLOBALS);
?>
Result is:
Array ( [GLOBALS] => Array *RECURSION* [_POST] => Array ( ) [_GET] => Array ( ) [_COOKIE] => Array ( [PHPSESSID] => 2jnfmopbi5h2b8l169svie63b3 [__utma] => 196765739.194337144.1399825592.1404818990.1404840354.13 [__utmc] => 196765739 [__utmz] => 196765739.1399825592.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)
[_ga] => GA1.3.194337144.1399825592 ) [_FILES] => Array ( ) )



So in getData.php, when print $GLOBALS variable, it show nothing. Is this a problem of $GLOBALS in SuperGlobal when run suPHP?
And how can I use a variable for all request in suPHP?

Thank you very much!
 
Back
Top