How to Check Server Info

Page content

How to create and use the phpinfo.php file

Often while troubleshooting a problem or installing Wordpress, users seek information regarding which version of PHP they are using as well as other server related information. Apart from PHP, users may need information regarding MySQL and the OS being used. For users who do not have information about the phpinfo file, this information may be difficult to find. However, they can easily find this information without having to search their site for long or without asking their host.

The phpinfo() function can be easily used to collect all the server related information. This function queries the server and generates a long report with a vast set of data. The file may have some moderately sensitive information which can be utilized by hackers to gain access to your server. So, the best way out is to give this file an obscure name and not the regular phpinfo.php name. You can give it an obscure name like fghd546.php. Apart from that, once you have checked out the required information, you can delete this file.

You can create this file in the root folder of your site using either SSH or SFTP connection. For example, you can SSH to your server and then change directory to the root folder:

cd /var/www/html

After that, you can open the file using nano:

Sudo nano fghd546.php

Now, paste the following content into this file:

<?php phpinfo(); ?>

Make sure there are no spaces before or after the function. Close and save the file. Otherwise, you can create the file using notepad and then upload it to your root folder using a SFTP client like Cyberduck or Filezilla. Once you have collected the required information, you can also delete this file.

Now, you just need to go to that page on your website such as example.com/fghd546.php and you will be able to find detailed information regarding php version, OS and other things. The report is multiple pages long.

phpinfo file

Server Info in Wordpress from Site Health

If you need only basic server information and you are on Wordpress, you can easily check out this information from your admin dashboard. Login to your Wordpress dashboard and click on tools in the right sidebar. Now click on Site Health. You will see two tabs titled Status and Info. click on Info and you will see several sections included in it.

At the bottom of the Info tab, you will find sections titled Server, Database, Wordpress constants and filesystem permissions. Click on Server to expand this section. You will find the following information included in this section apart from some more variables.

  • Server architecture

  • Web server

  • PHP version

  • PHP SAPI

  • PHP max input variables

  • PHP time limit

  • PHP memory limit

  • Max input time

  • Upload max filesize

  • PHP post max size

Similarly, you can expand the database tab to learn more about your database including server version, database name, username and host.