Tuesday, 21 July 2015

phpinfo()

This function is used to know about configuration details of PHP installed in our machine. Such detailed information returned by this phpinfo() includes, platform information, PHP and server environment, HTTP header information, PHP core details like version and directives status, License information and etc.
phpinfo() function has an optional argument. If this functions is called with no argument, then will display all information. We can check it by executing the following code.
<?php
phpinfo();
?>
php_info
We can also request specific details to be displayed to the browser by passing available constants to this function. Following list shows such available options.
  • INFO_GENERAL – This will return information about platform, compiler, architecture, API and etc.
  • INFO_CREDITS – This option provides a hyperlink which shows details about authors, documentation, QA and infrastructure team.
  • INFO_CONFIGURATION – Displays PHP core configuration details.
  • INFO_MODULES – shows all available platform modules with their directive, environment variables.
  • INFO_ENVIRONMENT – will list all environment variables like APPDATA, HOMEPATH and etc.
  • INFO_VARIABLES – Shows array of predefined global variables.
  • INFO_LICENSE – This shows access rights statement based on PHP license.
  • INFO_ALL – Displays all information.
Note: php_info() and php_info(INFO_ALL) both provide same effect on browser.

Use of phpinfo()

This function is used to check if required support is available with the server or not. For example, in PHP, we can work with image, if there is GD support.
If we cannot use the image related functions in a PHP script we can check for the availability of GD support using phpinfo() by,
php_info_modules

0 comments:

Post a Comment