How to Easily Create and Use a phpinfo Page (In 3 Steps) (2024)

PHP is a vital coding language for WordPress users. Even if you’re not a developer, you may still need to understand a little about it in order to maintain your site. However, if you don’t know where to look, finding even the most basic PHP information for your WordPress installation can be tricky.

Fortunately, if you care to take a few minutes to set it up, you can create a single page where you’ll find all the PHP information you need. Even better, it only takes a single line of code to do so.

In this post, we’ll introduce you to the phpinfo() function and explain why it may be useful to you. Then we’ll show you how to use it to create a phpinfo page for your WordPress site.

Let’s get started!

An Introduction to the phpinfo() Function

phpinfo() is a PHP functionor a snippet of code that takes in one or more parameters and returns a value. Running phpinfo() will display information regarding your site’s PHP configuration, including:

  • The current version of PHP your site is running.
  • Your server information and environment.
  • The PHP environment.
  • Your Operating System (OS) version information.
  • Paths, including the location of php.ini.
  • Master and local values for PHP configuration options.
  • HTTP headers.
  • The PHP License.
  • Modules and extensions currently in use.

Using the function alone will return all available information. However, there are also a handful of parameters you can use, in order to access only the specific information you want to see. These include:

  • INFO_GENERAL: Displays the configuration line, web server, OS, and more.
  • INFO_CREDITS: Shows a list of PHP developers, modules, etc.
  • INFO_CONFIGURATION: Returns the current local and master directives.
  • INFO_MODULES: Shares all extensions and their settings.
  • INFO_ENVIRONMENT: Includes all environment variable information.
  • INFO_VARIABLES: Shows all predefined variables from Environment, GET, POST, Cookie, Server (EGPCS).
  • INFO_LICENSE: Displays the PHP License.
  • INFO_ALL: Returns all available information (you can accomplish the same thing by using no parameters).

One way to use the phpinfo() function is by creating a phpinfo page, as we’ll describe later in this post. However, it’s important to note that you can find some of the information above without the extra trouble of using that function.

For example, the WordPress Site Health feature included in version 5.2 and above can share details about your web server, PHP version, memory limit, and more. Simply navigate to Tools > Site Health > Info > Server to find this data:

How to Easily Create and Use a phpinfo Page (In 3 Steps) (1)

Rather than checking for these pieces of information, phpinfo() is more suited to assist you with debugging attempts. The EGPCS data available via this function makes it particularly helpful in that regard.

Suggested reading: How to Improve PHP Memory Limit in WordPress.

How to Create a phpinfo Page (In 3 Steps)

If you have a basic understanding of File Transfer Protocol (FTP) and how to use an FTP client, creating a phpinfo page is really quite simple. In the following sections, we’ve broken it down into three short steps.

Step 1: Create a phpinfo.php File and Upload It to Your Server

To start creating this page, open up your preferred text editor. In a new document, add the following line of code:

<?phpphpinfo( );?>

If you wish to use one of the parameters mentioned above, you should insert it between the parentheses here. Then, save the file as “phpinfo.php”. If you prefer, you can use a different name (we’ll explain why you might want to do so in Step 3), but you must use the .php extension.

Next, open up FileZilla or another FTP client, and connect to your site’s server using your FTP credentials. Then, upload your new phpinfo.php file to the public_html folder:

How to Easily Create and Use a phpinfo Page (In 3 Steps) (2)

You’ve now successfully added the phpinfo page to your site. In order to view the page, however, you’ll need to know where to find it.

Step 2: Access the phpinfo Page in Your Browser

Once it’s uploaded to your server, your phpinfo page will become publicly available. This means you (and anyone else) can view it in a browser by appending /phpinfo.php to the end of your site’s domain:

How to Easily Create and Use a phpinfo Page (In 3 Steps) (3)

If you didn’t use any parameters and chose to return all of your PHP information, this page will likely be quite long. You can locate the specific details you’re looking for by using the Find function (CTRL or CMD + F) on your computer:

How to Easily Create and Use a phpinfo Page (In 3 Steps) (4)

You can now use this information to carry out any necessary debugging or other tasks.

Step 3: Delete or Rename Your phpinfo Page

As we mentioned in Step 2, because your phpinfo.php file was placed in your public_html folder, it’s now publically available. The problem with this is that some of the information the phpinfo() function returns is sensitive and could help a malicious hacker gain access to your server.

Attackers may even employ bots to search for phpinfo pages in order to exploit them. For this reason, once you’ve finished using yours, it’s best to delete it. You can do so by returning to your FTP client.

Then, connect to your server again and open public_html. Right-click on your phpinfo.php file and select Delete:

How to Easily Create and Use a phpinfo Page (In 3 Steps) (5)

Alternatively, some users choose to rename their phpinfo page to help hide it from hackers. You might use a random string of letters and numbers, for example, instead of “phpinfo”. Note that this will change the URL you use to access your phpinfo page as well.

This means that you’ll need to remember the name you assign to your phpinfo page so you can reach it whenever you like. However, this isn’t a guaranteed solution for preventing a security breach, so it’s best to simply create the page when needed and then delete it.


The phpinfo() function can provide valuable information for debugging your site. An easy way to put it to good use is to create a phpinfo page, so you can easily view all of your PHP information in your browser.

It takes just three simple steps to create and use this page safely:

  1. Create your phpinfo.php file and upload it to your server via FTP.
  2. Access your phpinfo page via your browser.
  3. Delete or rename your phpinfo page when you’re done using it.
How to Easily Create and Use a phpinfo Page (In 3 Steps) (2024)


How to use PHPInfo? ›

The phpinfo() function can be used to output a large amount of information about your PHP installation and can be used to identify installation and configuration problems. To run the function, just create a new file called test. php and place it into the root directory of your web server.

How to run PHPInfo in browser? ›

Use your browser to go to, where represents your web site's domain name. The page displays a large amount of information about the PHP installation. For security reasons, you should disable any calls to the phpinfo() function when web site development and testing is complete.

How do I add Phpinfo to WordPress? ›

Method 1: Using a Plugin

One popular plugin is “phpinfo() WP,” which is available for free from the WordPress plugin repository. To use the phpinfo() WP plugin, simply install and activate it on your WordPress site. Then, go to Tools > phpinfo() WP to access the plugin's settings page.

How to create a new page in PHP? ›

PHP Create File - fopen()

The fopen() function is also used to create a file. Maybe a little confusing, but in PHP, a file is created using the same function used to open files. If you use fopen() on a file that does not exist, it will create it, given that the file is opened for writing (w) or appending (a).

How to create a website page using PHP? ›

Building Your First PHP Website: A Beginner's Guide
  1. Step 1: Get Your Tools Ready. ...
  2. Step 2: Plan Your Website Structure. ...
  3. Step 3: Create the Skeleton with HTML. ...
  4. Step 4: Make It Dynamic with PHP. ...
  5. Step 5: Say Hello with a Contact Form. ...
  6. Step 6: Handle the Messages. ...
  7. Step 7: Make It Look Good with Styles.
Oct 12, 2023

How to check PHP version using PHPInfo? ›

This works on any account that supports PHP.
  1. Create a new text file containing the following line: <? php phpinfo(); ?>
  2. Save this file as info. php .
  3. Upload it to the root of any website.

How to use PHP data in HTML? ›

You can add PHP tags to your HTML Page. You simply need to enclose the PHP code with the PHP starts tag <? php and the PHP end tag ?>. The code wrapped between these two tags is considered to be PHP code, and it will be executed on the server side before the requested file is sent to the client browser.

How to get PHP configuration information? ›

Make sure the Web server is running, open a browser and type http://SERVER-IP/phptest.php. You should then see a screen showing detailed information about the PHP version you are using and installed modules.

How do I enable Phpinfo in PHP ini? ›

If phpinfo() is disabled and you want to enable it, try the following:
  1. If you have access to the server's php. ini file and the line that includes the disable_functions directive says disable_functions = phpinfo then change it to disable_functions =
  2. If you don't have access, please contact your server administrator.

How to open PHP page in browser? ›

Navigate to "localhost:8888" in your browser's address bar. The address bar is where you normally see "https://www." To do this, type "localhost:8888" and press ↵ Enter (Windows) or ⏎ Return (Mac). You'll see a directory of your PHP files displayed on the page. Click the PHP file to run the script in your browser.

How to get user browser information in PHP? ›

PHP get_browser() Function

echo $_SERVER['HTTP_USER_AGENT']; $browser = get_browser(); print_r($browser);

How to create a PHPinfo page? ›

How to Create a phpinfo Page
  1. Log into your cPanel.
  2. In the Files section of your cPanel, open the File Manager option.
  3. Navigate to the directory you are working with. ...
  4. In the top menu, click +File option to create a new file.
  5. When prompted for the file name, enter phpinfo. ...
  6. Find the phpinfo.
Dec 4, 2023

How to use PHP page in WordPress? ›

Install and activate the Insert PHP Code Snippet plugin.
  1. Setting Up Your Code Snippet. ...
  2. Click the button to “Add New PHP Code Snippet.”
  3. Input a Tracking Name for the snippet. ...
  4. Input the PHP code.
  5. Once you are done, click the “Create” button on the bottom.
  6. Now, you will see a shortcode created for the code snippet.

How to add PHP code to page? ›

  1. To start, install the Insert PHP Code Snippet plugin, then click activate.
  2. Then, navigate to the PHP Code Snippets section under the plugin's menu.
  3. Click “Add New PHP Code Snippet”.
  4. Here, you can make your snippet.
Jan 15, 2020

How to host a PHP page? ›

How to Host PHP Websites: 9 Steps
  1. Choose a Hosting Provider. The first step is to choose a hosting provider that offers the type of hosting that best suits your website's needs. ...
  2. Choose a Hosting Plan. ...
  3. Install a Web Server. ...
  4. Install PHP. ...
  5. Set Up a Database. ...
  6. Install a Control Panel. ...
  7. Configure Security. ...
  8. Upload Your Website.
Feb 29, 2024

How to make HTML page into PHP? ›

The simplest and easiest technique to link the two programs is to change the file extension of the external PHP file and link it to HTML. The only thing you need to do is switch the . HTML extension to . php.

How to create first page in PHP? ›

A simple programme to input is the following:To do this, create a file called hello. php and put it in your web server's root directory. After you've done that, input the text from the above picture and you'll have created your first PHP page, albeit a simple one.

How to open a PHP page? ›

Go to the location in which your PHP file is stored, then click the PHP file to select it. Click Open. It's in the bottom-right corner of the window. Doing so opens the PHP file in BBEdit; you should now be able to see the PHP file's text.

Top Articles
Latest Posts
Article information

Author: Mr. See Jast

Last Updated:

Views: 5735

Rating: 4.4 / 5 (55 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Mr. See Jast

Birthday: 1999-07-30

Address: 8409 Megan Mountain, New Mathew, MT 44997-8193

Phone: +5023589614038

Job: Chief Executive

Hobby: Leather crafting, Flag Football, Candle making, Flying, Poi, Gunsmithing, Swimming

Introduction: My name is Mr. See Jast, I am a open, jolly, gorgeous, courageous, inexpensive, friendly, homely person who loves writing and wants to share my knowledge and understanding with you.