Viewing your site's PHP version and settings

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

  1. Log into your server using an FTP client such as Filezilla.
  2. Create a blank file titled phpinfo.php in Filezilla. Ensure it has the .php extension and not a .txt extension.
  3. Edit this phpinfo.php file and add the following lines:
    <?php 
    phpinfo();
    ?>
  4. 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

  1. Log into your server via SSH.
  2. Ensure you're in your site's directory (where all the other site files are).
  3. View the Creating and editing a file via SSH article. This example uses nano to create and open the file:
    [server]$ nano phpinfo.php
  4. When the file is open, add the following lines:
    <?php 
    phpinfo();
    ?>
  5. Save and close the file and return to your shell.
  6. Visit the file in a browser. For example: example.com/phpinfo.php

The page lists all PHP settings currently used on your website.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?