suPHP and $GLOBALS variable scope

Hello,
I’m trying to use $GLOBALS in suPHP but it can’t give me data.
Example:
File setData.php

<?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

<?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!

Because you’re using the wrong one. You need to use whatever it is you used in the form method attr. Try either _POST or _GET or _REQUEST.

OK, thanks. I’m looking for a share data between request of many IP, but I have found a new solution.

Thanks.

Sponsor our Newsletter | Privacy Policy | Terms of Service