Get PHP configuration information using phpinfo()

admin_img Posted By Bajarangi soft , Posted On 31-12-2020

PHP provides us with a built-in function phpinfo() which gives us the details about the PHP version and PHP configuration of PHP installed in our system. To know about the Configurations and PHP version which is installed in your computer, a simple PHP script can be used. The script consists of a PHP function called “phpinfo()” which outputs information about PHP’s configuration. The phpinfo() function is also useful in the debugging process.

php information using phpinfo()

This function generally outputs a large amount of information, such as:

  1. Information about PHP compilation options and extensions.
  2. PHP version.
  3. Server information and environment (if compiled as a module).
  4. PHP environment.
  5. OS version information, paths, master and local values of configuration options.
  6. HTTP headers.
  7. PHP license.
Syntax:

TTP heade

Parameters:
$what : It is an optional parameter which can be used to display specific information.
It can take the following values:

  1. INFO_GENERAL:It is used to display the configuration line, php.ini location, build date, Web Server, System and more.
  2. INFO_CREDITS:It is used to display PHP Credits.
  3. INFO_CONFIGURATION: It is used to display current, local and Master values for PHP directives.
  4. INFO_MODULES: It is used to display loaded modules and their respective settings.
  5. INFO_ENVIRONMENT: It is used to display the environment variable information.
  6. INFO_VARIABLES:It shows all predefined variables from EGPCS (Environment, GET, POST, Cookie, Server).
  7. INFO_LICENSE:It is used to display PHP License information.
  8. INFO_ALL:It shows all of the above information.

Return Type: The phpinfo() function return a boolean value. That is, it returns true on success and false on faliure.
Displaying Complete information: To display the complete information on the PHP version, configurations, environment details etc. the phpinfo() function should be executed in the following way:

Syntax:

<?php 

phpinfo(); 

?> 

Related Post