How to Create a phpinfo file

You are here:
Estimated reading time: 2 min

PHP is a fundamental coding language for WordPress users. Even if you’re not a developer, you might need to understand this a bit to keep your site running. PHP has many environment variables that you can update as needed. However, if you don’t know where to look, it can be challenging to find even the most basic PHP information for your WordPress installation.

phpinfo() is a PHP function or code snippet that takes one or more parameters and returns a value, providing valuable information for debugging your site. Running phpinfo() allows you to easily display all available information about your site’s PHP configuration. This includes versions of your PHP, Apache/IIS, GD etc. A phpinfo page gathers a lot of useful information about your PHP configuration. For example, you can check if your PHP configurations meet the requirements of any software you want to run on your server or if you need to update your PHP memory_limit to prevent certain scripts from running out of memory.

In this tutorial, we’ll show you how to create a phpinfo page to display your hosting account’s current PHP settings through your cPanel. Fortunately, the installation takes a few minutes and a line of code to execute.

  • Log into your cPanel.
  • In the Files section of your cPanel, open the File Manager option.
  • Click “public_html” folder and navigate to the directory you are working with
  • In the top menu, click on the +File option to create a new file.
  • Enter phpinfo.php
  • *Note the file name can be anything you want, only the extension must be .php (FileName.php).
  • Find the phpinfo.php file in your list of files (it should update automatically).
  • Right-click on it and click Edit.
  • Enter the following code into the phpinfo.php file.
<? phpinfo(); ?>
Then click Save Changes.

How to View your PHP Settings
Now that you have created the phpinfo page, we’ll show you how to access it and view your PHP settings.

You can now access this page from your browser. If you created the file in your public_html folder, you should visit https://testing.com/phpinfo.php.

Be sure to replace testing.com with your actual domain name.

To find the specific value for a parameter, search the page for what you are looking for.

WARNING: Your phpinfo page has many PHP settings that you do not wish to broadcast to the world.
When you are done using the file, be sure to delete it.

Another path you can take instead of deleting it however is to name the file something other than phpinfo.php. Since phpinfo.php is such a common name, ‘bots’ on the web will randomly search for files named phpinfo.php. Setting the file name to something like 7845734554.php would never be guessed by a bot (so no one would ever find it) but it might be hard to remember this in the future.

You have now learned how to create a phpinfo.php file and verify PHP information through your hosting control panel or default browser.

Was this article helpful?
Dislike 0

Author

Joshua

Web Hosting Geek Technical Support Staff G Online Sites