PHPINFO

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

Bạn đang xem: Phpinfo


Fortunately, if you care khổng lồ take a few minutes to lớn mix it up, you can create a single page where you’ll find all the PHPhường information you need. Even better, it only takes a single line of code to lớn vì chưng so.

In this post, we’ll introduce you lớn the phpinfo() function & explain why it may be useful lớn you. Then we’ll show you how to lớn use it khổng lồ create a phpinfo page for your WordPress site.

Let’s get started!


An Introduction khổng lồ the phpinfo() Function

phpinfo() is a PHP function or a snippet of code that takes in one or more parameters và 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 VPS information and environment.The PHP environment.Your Operating System (OS) version information.Master & local values for PHP configuration options.Modules & 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 lớn access only the specific information you want lớn see. These include:

INFO_GENERAL: Displays the configuration line, website VPS, OS, và more.INFO_CREDITS: Shows a các mục of PHPhường developers, modules, etc.INFO_CONFIGURATION: Returns the current local & master directives.INFO_MODULES: Shares all extensions and their settings.INFO_ENVIRONMENT: Includes all environment variable information.INFO_LICENSE: Displays the PHP License.INFO_ALL: Returns all available information (you can accomplish the same thing by using no parameters).

Xem thêm: Các Yếu Tố Dễ Gây Sặc Sữa Ở Trẻ Sơ Sinh Bị Trớ Sữa Ra Mũi, Trẻ Sơ Sinh Bị Trớ Sữa Lên Mũi

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 & above sầu can nội dung details about your web hệ thống, PHPhường version, memory limit, & more. Simply navigate khổng lồ Tools > Site Health > Info > Server to find this data:


*

Site Health feature


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

Suggested reading: How khổng lồ Improve PHP. Memory Limit in WordPress.

How khổng lồ Create a phpinfo Page (In 3 Steps)

If you have a basic understanding of File Transfer Protocol (FTP) & how khổng lồ use an FTP client, creating a phpinfo page is really quite simple. In the following sections, we’ve sầu broken it down inkhổng lồ three short steps.

Step 1: Create a phpinfo.php File and Upload It lớn Your Server

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

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


Want khổng lồ know how we increased our traffic over 1000%?

Join đôi mươi,000+ others who get our weekly newsletter with insider WordPress tips!


Next, open up FileZilla or another FTPhường client, and connect to lớn your site’s VPS using your FTP credentials. Then, upload your new phpinfo.php tệp tin lớn the public_html folder:


*

Adding the phpinfo.php file


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

Step 2: Access the phpinfo Page in Your Browser

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


*

How the phpinfo page looks like


If you didn’t use any parameters and chose to return all of your PHPhường 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:


*

Find function example


Tired of subpar level 1 WordPress hosting tư vấn without the answers? Try our world-class support team! Check out our plans


Step 3: Delete or Rename Your phpinfo Page

As we mentioned in Step 2, because your phpinfo.php tệp tin 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 sầu & could help a malicious hacker gain access khổng lồ your VPS.

Attackers may even employ bots to search for phpinfo pages in order khổng lồ exploit them. For this reason, once you’ve finished using yours, it’s best khổng lồ delete it. You can bởi vì so by returning lớn your FTP client.

Then, connect khổng lồ your hệ thống again and open public_html. Right-cliông xã on your phpinfo.php tệp tin & select Delete:


*

Deleting the phpinfo.php file


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

This means that you’ll need lớn rethành viên the name you assign to your phpinfo page so you can reach it whenever you lượt thích. 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.

A phpinfo page gather lots of useful information about your PHPhường configuration. Learn how to lớn create one for your WordPress site! ℹ️