Skip to content

How to check PHP version and configuration

How to check PHP version and configuration

The PHP version used by a website depends on the hosting provider and account configuration. It can differ between the command-line interface (CLI) and the web server, so check the environment that actually runs your site. For Linux or macOS over SSH, or Windows Command Prompt or PowerShell, run php -v if PHP CLI is installed and available on your PATH. This reports the command-line version only; it may differ from the PHP version used by the website through its web server or PHP-FPM handler.
To check the PHP version assigned to a domain, open cPanel and look under Software for MultiPHP Manager or Select PHP Version. The interface and available versions depend on the hosting provider. Select the domain and read its assigned PHP version before changing anything. For current cPanel behavior, see cPanel’s MultiPHP Manager documentation:

cPanel PHP settings screen showing the selected PHP version
You will see the current PHP version above PHP extensions:

cPanel PHP settings screen showing the available PHP extensionsAnother way to inspect PHP configuration is the phpinfo() function, which displays detailed PHP build, extension, server and environment information. Use it only behind access restrictions and remove the temporary file immediately; never leave a public phpinfo page online.

for cPanel Basic theme:

1. Log into your cPanel account, go to Files section > File Manager menu:

cPanel File Manager with the public_html directory selected

2. Navigate to public_html directory, click on New File and create a phpinfo.php file:

cPanel File Manager dialog for creating a phpinfo.php file

cPanel File Manager showing the phpinfo.php file in public_html

3. Find the newly created file in the list and click on Code Editor:

cPanel Code Editor opened for the phpinfo.php file

4. Add the lines of the code provided below to the file and click on Save Changes:

<?php
phpinfo();
?>

phpinfo() PHP code entered in the cPanel Code Editor

5. To see the detailed information about PHP configuration of your account, open http://yourdomain.com/phpinfo.php link in your browser, replacing yourdomain.com with your main domain name.

NOTE: A public phpinfo page can reveal server and environment details. Prefer the hosting panel or command line; if a temporary file is unavoidable, restrict access before testing and remove it immediately afterwards.

for cPanel Retro theme:

1. Log into your cPanel account, go to the section Files > File Manager menu:

cPanel Retro File Manager opened from the Files section

2. Navigate to the public_html directory, click on New File and create a phpinfo.php file:

cPanel Retro File Manager creating a phpinfo.php file in public_html

3.Find the newly created file in the list and click on Code Editor:

cPanel Retro Code Editor opened for phpinfo.php

4. Add the lines of the code provided below to the file and click on Save Changes:


<?php
phpinfo();
?> 

phpinfo() PHP code entered in the cPanel Retro Code Editor

5. To see the detailed information about PHP configuration of your account, open http://yourdomain.com/phpinfo.php link in your browser, replacing yourdomain.com with your main domain name.

NOTE: 
A public phpinfo page can reveal server and environment details. Prefer the hosting panel or command line; if a temporary file is unavoidable, restrict access before testing and remove it immediately afterwards.

That’s it!

Leave a Reply

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