PHP comes with a built in function phpinfo() that will generate all the information about the current PHP that is being used.
This file outputs a large amount of information, such as:
- Information about PHP compilation options and extensions
- PHP version
- Server information and environment (if compiled as a module)
- PHP environment
- OS version information, paths, master and local values of configuration options
- HTTP headers
- PHP license
Because every system is set up differently, phpinfo() is commonly used to check PHP configuration settings and for available predefined variables on your particular system.
phpinfo() is also a valuable debugging tool, as it contains all EGPCS (Environment, GET, POST, Cookie, and Server) data.
Create a PHP Info Page
Luckily, creating a phpinfo page can be performed fairly quickly and easily!
- Open your website files using a File Manager, FTP, or SSH.
- Navigate to your website's root directory. This generally will be:
- Plesk: httpdocs
- cPanel: public_html
- Create a new file named phpinfo.php in your associated website root directly
You do have the option to add this file into any subdirectory of your choosing. - Add the following lines into your phpinfo.php file:
<?php
// Show all information, defaults to INFO_ALL
phpinfo();
?> -
Save your edits.
- You have just created a php info page! Feel free to continue through this article for instructions on how to view your page.