Learning and Sharing
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
  • Home
  • Blog
  • Linux
  • macOS
  • Virtualization
    • VMware
    • VirtualBox
  • Windows
    • Windows 11
    • Windows 10
    • Windows Server
  • Series
    • Symantec
    • Intune
    • Microsoft Azure
    • Powershell
    • VirtualBox
    • VMware
    • PowerShell Learning
    • Microsoft Graph
  • More
    • Auto Installation
    • AEC Installation
  • Contact
No Result
View All Result
No Result
View All Result

How to Create phpinfo File and Check PHP Information

October 29, 2022
in Blog
0
ADVERTISEMENT

Table of Contents

If you’re looking for a way to check your website’s PHP configuration, also known as phpinfo. For example, you might want to check whether your PHP configurations meet the requirements of any software you want to run on your server.

<?php
phpinfo();
?>

phpinfo() is a PHP function or 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.

In this post, we’ll show you how to create a phpinfo.php file and also how to check its detailed information.

Creating the phpinfo.php file through terminal

Note This is the root folder of our example website

1. Connect to your VPS using SSH protocol.

2. Create a fine named phpinfo.php in the root directory of your website.

echo "<?php phpinfo(); ?>" > /var/www/bonguides.me/phpinfo.php
# echo "<?php phpinfo(); ?>" > /var/www/bonguides.me/phpinfo.php
# ls -l /var/www/bonguides.me/
total 216
-rw-r--r--.  1 nginx nginx   405 Feb  6  2020 index.php
-rw-r--r--.  1 root  root     20 Oct 28 20:52 phpinfo.php
-rw-r--r--.  1 nginx nginx 19915 Dec 31  2021 license.txt
-rw-r--r--.  1 nginx nginx  7401 Mar 22  2022 readme.html
-rw-r--r--.  1 nginx nginx  7165 Jan 20  2021 wp-activate.php
-rw-r--r--.  1 nginx nginx  2993 Oct 28 20:29 wp-config.php
drwxr-xr-x.  4 nginx nginx    52 Oct 17 17:10 wp-content
...

3. Once done, 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.

Bg2226

Delete or Rename Your phpinfo Page

As we mentioned, because your phpinfo.php file was placed in your web root folder, it’s now publicly 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.

If you don’t want your phpinfo page to be displayed all the time, you can easily disable the file by giving it a different name. phpinfo.php_disabled, for instance.

Some people choose to rename their phpinfo page to help hide it from hackers. They use a random string of letters and numbers, for example, instead of phpinfo.php. 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.

###Disable phpinfo function
mv /var/www/bonguides.me/phpinfo.php /var/www/bonguides.me/phpinfo.php_disabled

###Delete phpinfo file
rm -f /var/www/bonguides.me/phpinfo.php
# mv /var/www/bonguides.me/info.php /var/www/bonguides.me/info.php_disabled
# ll
total 216
-rw-r--r--.  1 nginx nginx   405 Feb  6  2020 index.php
-rw-r--r--   1 root  root     20 Oct 28 21:04 info.php_disabled
-rw-r--r--.  1 nginx nginx 19915 Dec 31  2021 license.txt
-rw-r--r--.  1 nginx nginx  7401 Mar 22  2022 readme.html
...

Checking PHP Information using cPanel

If you’re using a web hosting service, you’re already have a native tool to check PHP configuration. The below image shows the PHP configurations in cPanel.

Bg2220

If you still need the phpinfo.php file, you can reach the same goal by creating a phpinfo.php file in your public_html directory using File Manager in cPanel.

Bg2221

Select the public_html folder then clicks create a new file.

Bg2222

Enter the php function, save the file then access your phpinfo.php page via your browser.

Bg2225

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

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.

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

<?php
phpinfo();
?>

2. Next, open up WinSCP 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:

Bg2227

You’ve now successfully added the phpinfo.php page to your site. In order to view the page, let’s appending /phpinfo.php to the end of your site’s domain.

Conclusion

By finishing this post, you’ve learned how to create a phpinfo.php file and how to check PHP information via your hosting control panel or your default browser.

ADVERTISEMENT
5/5 - (1 vote)
Previous Post

How to Compile, Install and Configure PHP on CentOS Linux

Next Post

How to Set an Azure Subscription for Default Login in PowerShell

Related Posts

Running Hyper-V and VMware Workstation on The Same Machine

August 15, 2024

How to Uninstall All Autodesk Products At Once Silently

July 29, 2024
Ftr5

How to Uninstall the Autodesk Genuine Service on Windows

July 29, 2024
Ftr19

How to Fix Windows Cannot Read the ProductKey From the Unattend Answer File in VirtualBox

July 26, 2024
Ftr25

How to Update Windows Terminal in Windows 10/11

July 26, 2024

How to Disable The Beep Sound in WSL Terminal on Windows

July 26, 2024

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How To Turn On uBlock Origin Extension in Chrome (2025)
  • Images Hidden Due To Mature Content Settings In CivitAI
  • Azure OpenAI vs Azure AI Hub, How to Choose the Right One for Your Needs

Categories

Stay in Touch

Discord Server

Join the Discord server with the site members for all questions and discussions.

Telegram Community

Jump in Telegram server. Ask questions and discuss everything with the site members.

Youtube Channel

Watch more videos, learning and sharing with Leo ❤❤❤. Sharing to be better.

Newsletter

Join the movement and receive our weekly Tech related newsletter. It’s Free.

General

Microsoft Windows

Microsoft Office

VMware

VirtualBox

Technology

PowerShell

Microsoft 365

Microsoft Teams

Email Servers

Copyright 2025 © All rights Reserved. Design by Leo with ❤

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory

No Result
View All Result
  • Home
  • Linux
  • Intune
  • macOS
  • VMware
  • VirtualBox
  • Powershell
  • Windows 10
  • Windows 11
  • Microsoft 365
  • Microsoft Azure
  • Microsoft Office
  • Active Directory