phpinfo

suggest change

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, 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), environment ($_ENV) and predefined variables.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:


Debugging:
* phpinfo
* Xdebug

Table Of Contents
2 Arrays
4 Types
10 Cookies
14 JSON
15 SOAP
17 cURL
19 XML
21 Traits
35 UTF-8
36 URLs
38 PHPDoc
41 Loops
44 Closur
51 Debugging
72 YAML
77 Cache
78 Streams
81 PDO
82 SQLite3
83 Sockets
87 MongoDB
93 IMAP
94 Redis
95 Imagick
102 APCu
108 PSR