What is PHPinfo? How to create PHPinfo.php file – PHP information page
At times in order to run specific script or to analyze and solve a problem in your server you will first need to find certain configuration information of your server. For instance several scripts may run out of memory and during such occasion you will need to find out your php memory limit and increase it. You can find all your php configuration information by creating a phpinfo file in your server. Let us see, what is PHPinfo? and how to create PHPinfo.php file and upload it to your server.
What is PHPinfo? – PHP information
All PHP versions come with simple and numerous information purposes. A PHPinfo file is a normal file that makes easier to find out all the information about the server. That is when accessing the phpinfo page from your browser this phpinfo function returns all the information about your php environment in a tabular form. To view this php information first you need to create a phpinfo file in your server.
How to create PHPinfo.php file or page
The command phpinfo () will get you the information on your current state of PHP. Here is how you create a phpinfo.php file.
<?php // PHP information, (INFO_ALL) Show all information phpinfo(INFO_ALL); ?>
- Copy and paste the above code in notepad or notepad++
- Save the file as phpinfo.php
- We are going to view the php settings for main domain so login to your cPanel or access public_html folder using FTP
- Now upload the phpinfo.php file there.
You can view your site’s php information (phpinfo page) by visiting http://yourdomain.com/phpinfo.php in your web browser. The information looks like the one below.
The page includes the following information
- PHP information
- PHP environment (server information)
- OS version information, configuration options
- PHP license etc.
It contains a large amount of information and to find any specific information press CTRL+F and search for the value. For example to find the memory limit search for memory_limit and you will get the local value as well as master value.
Note in the above code that is in line 3 (INFO_ALL) gets you all the information. Instead of (INFO_ALL) you can add the following constants and each will get the particular information.
INFO_GENERAL | INFO_CREDITS |INFO_MODULES | INFO_CONFIGURTION | INFO_ENVIRONMENT | INFO_LICENSE | INFO_VARIABLES
The PHP info page will display all your php settings and information. If you wish not to show it to public then you can delete the file after using it. Other way you can hide this file is by renaming the phpinfo.php file in to something different.
Hope this helped you with phpinfo.php file and page.