Overview
The PHP language has a special built-in function called phpinfo() that retrieves information about the PHP environment used on your site.
You can view this information by creating a phpinfo.php file and uploading it to your site. When viewed in a browser, you will see details about the PHP installation for the specific website.
This includes information about:
- the PHP version
- PHP compilation options and extensions
- server information and environment (if compiled as a module)
- the PHP environment
- OS version information, paths, master and local values of configuration options
- paths
- master and local values of configuration options
- HTTP headers, and
- the PHP License.
How do I create a phpinfo.php file?
Creating it on your computer and uploading to the server
- Log into your server using an FTP client such as Filezilla.
- Create a blank file titled phpinfo.php in Filezilla. Ensure it has the .php extension and not a .txt extension.
- Edit this phpinfo.php file and add the following lines:
<?php
phpinfo();
?> - Visit the file in a browser. For example: example.com/phpinfo.php
The page lists all PHP settings currently used on your website.
Creating the file on your server
- Log into your server via SSH.
- Ensure you're in your site's directory (where all the other site files are).
- View the Creating and editing a file via SSH article. This example uses nano to create and open the file:
[server]$ nano phpinfo.php
- When the file is open, add the following lines:
<?php
phpinfo();
?> - Save and close the file and return to your shell.
- Visit the file in a browser. For example: example.com/phpinfo.php
The page lists all PHP settings currently used on your website.