It is a very important and useful function of PHP to return information. It includes information about PHP compilation options and extensive version, server information and environment, PHP environment, OS version information, paths, HTTP headers and the PHP license. Please note that you can get PHP information not only from the browser but also from the command line.
Please refer to the following steps to create a phpinfo file.
- Login to cPanel account. Please refer to how to login to cPanel for more details.
- Navigate to File Manager and go to the public_html folder.
- From the header, choose to Create New File and give the file name phpinfo.php.
- Edit phpinfo.php file and insert the below lines in it.
<?php phpinfo();
?> - Now, we have created a phpinfo file. So, it is time to view that file. Let’s see how we can view that file.
- Kindly go to the browser and write “your IP Address/phpinfo.php” it will return the PHP information like version, environment.
This is how you can create and view the PHPInfo page in Linux.