How can I create a phpinfo.php page?
Overview
You can use a phpinfo() page to view the current PHP information for your server.
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 phpinfo.php page
-
To create a phpinfo file, open a plain text file, add the following lines, and save:
Filename: phpinfo.php
<?php // Show all information, defaults to INFO_ALL phpinfo(); ?>
NOTE:
Your phpinfo.php file needs to be a plain text file. This means you need to make it in a text editing program capable of producing plain text files.
- On a Windows machine, you can use Notepad, which is one of your built-in accessories.
- On a Mac, you can use TextEdit. You must first open the TextEdit "Preferences" menu and, in the "New Document" section, select "Plain text." Then, you should start a new document in TextEdit for your phpinfo.php file.
-
Upload the file to the server. You should upload your file to the exact directory you want to test. Typically, this will be your html (
/home/00000/domains/example.com/html/) httpdocs (/var/www/vhosts/example.com/httpdocs/) directory, although you can upload it to any subdirectory on your server as well. Use FTPFTP to upload the file. - Visit the page in your browser. If you uploaded it to your html directory, you should now visit http://www.example.com/phpinfo.php, replacing example.com with your own domain name.
- Now you can view all of the information about PHP for your server for that particular directory.
TIP:
You can use CTRL-F (Windows) or COMMAND-F (Mac) in most browsers to open a quick search function. This is useful for browsing through long web pages quickly, and a phpinfo page is very long.
(gs) Grid-Service pre-made phpinfo links
On the (gs) Grid-Service, you can visit the following links to view the PHP information for your server. Replace 00000 with your site number.
- PHP 5: http://s00000.gridserver.com/gs-bin/phpinfo.php5
- PHP 4: http://s00000.gridserver.com/gs-bin/phpinfo.php4