How do I view my PHP environment settings?

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. In Filezilla, create a blank file titled phpinfo.php. Make sure 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. Make sure 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 the file:
    [server]$ nano phpinfo.php
  4. The nano command opens a file. 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

External links

Did this article answer your questions?

Article last updated PST.