Warning

It is imperative that phpinfo is only used in a development environment. Never release code containing phpinfo into a production environment

Introduction

Having said that, it can be a useful tool in understanding the PHP environment (OS, configuration, versions, paths, modules) in which you are working, especially when chasing a bug. It is a simple built in function:

phpinfo();

It has one parameter $what that allows the output to be customized. The default is INFO_ALL, causing it to display all information and is commonly used during development to see the current state of PHP.

You can pass the parameter [INFO_* constants](http://php.net/manual/en/function.phpinfo.php#refsect1-function.phpinfo-parameters), combined with bitwise operators to see a customized list.

You can run it in the browser for a nicely formatted detailed look. It also works in PHP CLI, where you can pipe it into less for easier view.

Example

phpinfo(INFO_CONFIGURATION | INFO_ENVIRONMENT | INFO_VARIABLES);

This will display a list of PHP directives ([ini_get](<http://php.net/manual/en/function.ini-get.php>)), environment ([$_ENV](<http://php.net/manual/en/reserved.variables.environment.php>)) and predefined variables.