I am attempting to get a list of dependable(consistent across requests) list of "hidden" constants in PHP(as in, the client-side won't know about it in most cases without hacking).
Some of the things I am interested in is the following:
./configure
options.System
value in phpinfo. How can I get either just a portion of the phpinfo or get these values as a regular string? Note that it doesn't matter if there if markup included, but I don't want to parse the phpinfo as that just seems really slow and surely there is a better way..
Because every system is setup differently, phpinfo() is commonly used to check configuration settings and for available predefined variables on a given system. phpinfo() is also a valuable debugging tool as it contains all EGPCS (Environment, GET, POST, Cookie, Server) data.
An Introduction to the phpinfo() Function. phpinfo() is a PHP function or a snippet of code that takes in one or more parameters and returns a value. Running phpinfo() will display information regarding your site's PHP configuration, including: The current version of PHP your site is running.
Here you go:
ini_get_all()
or get_loaded_extensions()
were the closest I could find
php_uname()
apache_get_modules()
phpversion()
was the closest I could find
stream_get_wrappers()
stream_get_transports()
stream_get_filters()
See also get_defined_constants()
and some more.
As Chacha102 mentioned you can also use output control functions and parse the phpinfo()
:
ob_start();
phpinfo();
$variable = ob_get_contents();
ob_get_clean();
Due to the use of ob_get_clean()
it won't mess up other output buffering levels you may be using.
Most of the stuff available from phpinfo() can be found in constants. Try looking through:
print_r(get_defined_constants());
Or the functions on this page: http://us.php.net/manual/en/ref.info.php. There are tons of functions to get information about specific extensions.
The following functions might be worth looking at:
ini_get()
http://us.php.net/manual/en/function.ini-get.phpgetenv()
http://us.php.net/manual/en/function.getenv.phpget_cfg_var()
http://us.php.net/manual/en/function.get-cfg-var.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With