What is Phpinfo() file & How to create one for your Website?

If you are running a static HTML website, blog or a forum, then need may arise when you would like to know the PHP configuration of your hosting server.

A PHP Info file gives information about the current version of PHP running on your web server. The file also includes other important information like Database Schemes (current version of MySQL or SQLite Database), Apache or IIS Configurations, GD Module (used for Image Processing and Manipulations), PHP Settings (like safe_mode, register_globals etc.) and more.

You can see an Example of phpinfo() file here

From the details provided in above example file, you can easily deduce following information:

  • Current PHP Version.
  • Linux System Information and Build Date.
  • Configuration Commands.
  • Server API.
  • Support for Virtual Directory.
  • Configuration File Path, also known as php.ini.
  • PHP API and Extension.
  • Zend Extension.
  • Support for IPv6.
  • Registered PHP, Socket Transport and Filter Streams.
  • PHP Variables.
  • and more.

How to create a phpinfo() file?

1. Open Notepad or any other text editor on your computer and insert following line of PHP code in it:

<?php phpinfo(); ?>

2. Save this text document with file name as phpinfo and extension as .php. Now upload this file to the root directory of your domain, so that you can access it using following URL:

Whenever you access the above URL, you will be able to see the complete configuration information applicable for your website/server.