PDA

View Full Version : Phpinfo() and Global Vars


Jawelin
03-10-2002, 10:35 AM
How could I read all (each one) the vars displayed in phpinfo() ?
I found somewhere the reference to one or another .... but can't understand the exact difference between global var series.
Most of all, where find a complete reference of each global var accessible via PHP code (and hopefully echoable ... :pleased: ) Could I even redirect the output of phpinfo(parameter), for example ?

Note: I've already checked the PHP Manual: Predefined variables (http://www.php.net) page, but it isn't complete, as itself said Note: This list is neither exhaustive nor intended to be. It is simply a guideline as to what sorts of predefined variables you can expect to have access to in your script.

Even I got almost confused by the VBulletin management of those vars. Sometimes some are accessed by getenv() function, sometimes directly via a $HTTP_var constant.
What's the difference ???

Thanks

Bye

TECK
03-10-2002, 10:41 AM
http://www.php.net/manual/en/function.phpinfo.php

example: phpinfo(2) will show you only the credits. ;)

Admin
03-10-2002, 10:42 AM
To capture the output of phpinfo():
ob_start();
phpinfo();
$phpinfo = ob_get_contents();
ob_end_clean();

Jawelin
03-10-2002, 10:47 AM
Originally posted by nakkid
http://www.php.net/manual/en/function.phpinfo.php

example: phpinfo(2) will show you only the credits. ;)
Thanks, Nakkid. But I wouldn't only be shown that page. For instance, I would use one by one those vars...

Thanks even to FF. Is this the usual PHP redirection method into an object ?

Bye

P.S.: I updated my original request with some more info, meanwhile...

Admin
03-10-2002, 10:51 AM
It's called Output Buffering or Controlled Output, it's used to capture the output from going to the browser so you can do stuff with it.

Mark Hensler
03-10-2002, 06:28 PM
Originally posted by Jawelin
Even I got almost confused by the VBulletin management of those vars. Sometimes some are accessed by getenv() function, sometimes directly via a $HTTP_var constant.
What's the difference ???Most of those vars can be accessed directly by using $HTTP_XXXXX. But to access those vars in a function, you need to use getenv("HTTP_XXXXX") or $GLOBALS["HTTP_XXXXX"], or declare them as global in the function.

Jawelin
03-10-2002, 09:02 PM
Yes, thanks.
But what are the differences between ( in phpinfo() ):
- Apache variables
- Http header infos
- Php vars
and how each group of them could be accessed by php ?
(I mean with a $.... or associative array...)

Thanks again