How to Create phpinfo() File to Check PHP Information?

By Aditya varma

April 20, 2017

PHP, phpinfo

Introduction


Before we start creating a page to display phpinfo, let me introduce what is PHP? Where it will be used and why?


What is PHP?


PHP stands for Hypertext Preprocessor and is a server-side programming language, which is mostly used in websites development and can integrate with HTML.

Why is PHP so popular ?


Why is PHP so Popular

There are many reasons to use PHP for server side programming, firstly it is a free language with no licensing fees so the cost of using it is minimal.


PHP can interact with different database languages, it also includes MySQL. Also, PHP is a free language. Both MySQL and PHP are compatible with Apache and this would be the perfect platform to host Dynamic and Static websites.


So that is the reason PHP is being excessively used in recent times. Websites which were designed in PHP can also host on Windows, Linux and Unix servers.


What is phpinfo() ?


PHP includes a function known as phpinfo() that provides a formatted page with all the information about your PHP in which your website is hosted. You can use this to verify whether your web hosting server will support your application/code which you were suppose to host.


It is one of the option which helps developers to write the code based on the php modules the client's server is handling. This file provides information of all the php modules installed on the server, PHP Version, PHP limits and many more options.


You can use phpinfo() page to check PHP information of the server where you host your website.


When you check the output of the phpinfo() file it gives all information such as

  1. Information about PHP extensions and its compilation options.

  2. It displays PHP Version.

  3. If it is compiled as a module it displays server information and its environment.

  4. OS version information, paths, master and local values of configuration options.

  5. PHP Environment.

  6. PHP License

  7. Build date.

  8. Server API information

  9. PHP Modules.

  10. PHP variables.

As each system is setup diffentely, phpinfo() is commonly used to check PHP configuration settings and for available predefined variables on the server you are working.

It is also a valuable debugging tool, as it contains all EGPCS (Environment, GET, POST, Cookie, and Server) data.

CREATE A PHPINFO() PAGE

To create a phpinfo file, I can recommend you to open a text file and add the below lines to it and save.

Recommended Filename: phpinfo.php

<?php
//Shows all information, default modules of PHP
phpinfo();
?>

That's it. Now you can upload this file to the server where you have your webhosting account and access that in your browser. It will display all the phpinfo() file information which we discussed above.

Conclusion

Hope this article helps you create your own phpinfo() file where you can check PHP information of the server where you host your website. Please share your comments/suggestions in the below comments box.



Leave a Reply

Your email address will not be published. Required fields are marked

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Create a website in 3 simple steps

Choose a website template, add features, then customise! - Free Online Website builder.