405 of 410 menu

The phpinfo Function

The phpinfo function displays extensive information about the current PHP configuration, including module information, PHP version, environment and server settings. The function accepts an optional parameter that allows outputting only specific sections of information.

Syntax

phpinfo(int $flags = INFO_ALL);

Example

Let's output the complete PHP information:

<?php phpinfo(); ?>

The result will be an HTML page with detailed information about the PHP configuration.

Example

Let's output only the general PHP information:

<?php phpinfo(INFO_GENERAL); ?>

The result contains only general information about the PHP version, system, and build.

Example

Let's get only the information about loaded modules:

<?php phpinfo(INFO_MODULES); ?>

The result shows a list of all loaded PHP modules and their settings.

See Also

  • the phpversion function,
    which returns the current PHP version
  • the ini_get function,
    which returns the value of a specific PHP setting
byenru