How do I view my PHP environment settings?

The PHP language has a special built-in function called phpinfo() that can retrieve information about a particular installation and the environment in which it has been installed.

For example, if you have a site running PHP 5.6, you can create a phpinfo.php file for the site. When you visit the page, you're presented with details about the PHP 5.6 installation on that specific domain.

This includes information about:

  • PHP compilation options and extensions
  • the PHP version
  • server information and environment (if compiled as a module)
  • the PHP environment
  • OS version information, 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 .