Clever website slogan
Home > Tech > PHP


Outputs a large amount of information about the current state of PHP. This includes information about PHP compilation options and extensions, the PHP version, server information and environment (if compiled as a module), the PHP environment, OS version information, paths, master and local values of configuration options, HTTP headers, and the PHP License.

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.

<?php phpinfo(); ?>
Name (constant)ValueDescription
INFO_GENERAL 1 The configuration line, php.ini location, build date, Web Server, System and more.
INFO_CREDITS 2 PHP Credits. See also phpcredits().
INFO_CONFIGURATION 4 Current Local and Master values for PHP directives. See also ini_get().
INFO_MODULES 8 Loaded modules and their respective settings. See also get_loaded_extensions().
INFO_ENVIRONMENT 16 Environment Variable information that's also available in $_ENV.
INFO_VARIABLES 32 Shows all predefined variables from EGPCS (Environment, GET, POST, Cookie, Server).
INFO_LICENSE 64 PHP License information.
INFO_ALL -1 Shows all of the above.

the following is an example of phpinfo(INFO_VARIABLES) ouput:

_REQUEST["name"]no value
_POST["name"]no value
_SERVER["HTTP_USER_AGENT"] Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv: Gecko/20101026 Firefox/3.6.12
_SERVER["HTTP_ACCEPT"] text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
_SERVER["SERVER_SIGNATURE"] <address>Apache/2.2.14 (Ubuntu) Server at Port 80</address>
_SERVER["SERVER_SOFTWARE"]Apache/2.2.14 (Ubuntu)

Note: For more information on the $_POST, $_GET and $_REQUEST arrays see PHP Forms and User Input.