Welcome to phpinfo()

The phpinfo() function in PHP outputs detailed information about the current PHP environment and configuration settings. It is a valuable tool for developers and administrators to diagnose PHP-related issues and verify server configurations.

Usage

To use phpinfo():

  1. Create a PHP script containing the phpinfo() function call.
  2. Access the script through a web browser.
  3. Review the comprehensive report of PHP configuration settings, extensions, and environment variables.

Key Information Provided by phpinfo()

phpinfo() displays the following types of information:

  • PHP Version and System Information
  • Server Information (e.g., Apache, Nginx)
  • PHP Environment Variables
  • PHP Configuration Settings (from php.ini)
  • Loaded PHP Extensions and their Settings
  • Compiler Information and Build Environment
  • License Information

Security Considerations

Exercise caution when using phpinfo() in a production environment:

  • Restrict access to phpinfo() output to trusted users only.
  • Avoid displaying sensitive information such as paths and detailed server configurations.
  • Disable phpinfo() on production servers after debugging or diagnostics.