How to Create phpinfo() File to Check PHP Information?
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 ?
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
Information about PHP extensions and its compilation options.
It displays PHP Version.
If it is compiled as a module it displays server information and its environment.
OS version information, paths, master and local values of configuration options.
Server API information
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
//Shows all information, default modules of PHP
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.
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.