In command prompt type below

set PATH=%PATH%;C:\path\to\php

Where C:\path\to\php is the folder where your php.exe file is located. After this run

C:\>php -v

than you will see something like

PHP 7.3.6 (cli) (built: May 29 2019 12:11:00) 

UPDATE:

If you find that when you restart your computer, this solution will not work anymore:

Set the Path like as following:

Step 1 - Click on the Windows icon

Step 2 - Click on the Settings icon

Step 3 - Click on System

Step 4 - Click on About

Step 5 - Click on System info

Step 6 - Click on Advanced system settings

Step 7 - Click on Environment variables...

Step 8 - Select Path row and then click Edit

Step 9 - Click New and then click Browse, then in the next panel which will open you need to select the folder you want in the Path. For the initial premise of this guide i will add the folder C:\Users\NewFolderInPath

Note: Replace your PHP installed path(e.g:C:\Program Files\php) with the above path .

Step 10 - Click OK and click every OK button you will encounter to close every previous windows.

Answer from NullPoiиteя on Stack Overflow
🌐
nixCraft
cyberciti.biz › nixcraft › howto › php › how to check php version
How to Check and Print PHP Version on Linux / Unix - nixCraft
April 9, 2024 - Here is another output indicating that I am using PHP 5.x on an older RHEL server: $ php -v Note that I used -v instead of long --version: PHP 5.3.3 (cgi-fcgi) (built: Jun 25 2012 04:38:39) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, ...
Top answer
1 of 16
192

In command prompt type below

set PATH=%PATH%;C:\path\to\php

Where C:\path\to\php is the folder where your php.exe file is located. After this run

C:\>php -v

than you will see something like

PHP 7.3.6 (cli) (built: May 29 2019 12:11:00) 

UPDATE:

If you find that when you restart your computer, this solution will not work anymore:

Set the Path like as following:

Step 1 - Click on the Windows icon

Step 2 - Click on the Settings icon

Step 3 - Click on System

Step 4 - Click on About

Step 5 - Click on System info

Step 6 - Click on Advanced system settings

Step 7 - Click on Environment variables...

Step 8 - Select Path row and then click Edit

Step 9 - Click New and then click Browse, then in the next panel which will open you need to select the folder you want in the Path. For the initial premise of this guide i will add the folder C:\Users\NewFolderInPath

Note: Replace your PHP installed path(e.g:C:\Program Files\php) with the above path .

Step 10 - Click OK and click every OK button you will encounter to close every previous windows.

2 of 16
29

You just need to find out where is your PHP folder.

  • If you are using XAMPP or WAMP then you will see a php folder.
  • You just need to go into the php folder using your cmd using command

cd \xampp\php (FOR XAMPP)

cd \wamp\php (FOR WAMP)

  • And then just type in this command

php -v

  • Then you will see something like

PHP 5.6.11 (cli) (built: Jul 9 2015 20:55:40) Copyright (c) 1997-2015 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies

🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to check php version
How to Check PHP Version | phoenixNAP KB
December 9, 2025 - Note: If there is more than one PHP version installed on the server, the php -v command shows the default command-line interface (CLI) version. This version is not necessarily the one that runs on hosted websites.
🌐
Simplified
simplified.guide › php › check-version
How to check PHP version
Run php -v from the command line. $ php -v PHP 7.4.3 (cli) (built: May 26 2020 12:24:22) ( NTS ) Copyright (c) The PHP Group Zend Engine v3.4.0, Copyright (c) Zend Technologies with Zend OPcache v7.4.3, Copyright (c), by Zend Technologies · Run php -i from the command line.
🌐
Wikihow
wikihow.com › computers and electronics › software › web programming › how to check php version: 3 ways on windows, mac, & linux
How to Check PHP Version: 3 Ways on Windows, Mac, & Linux
December 3, 2025 - To see which version of PHP is installed, open a command prompt or terminal, type "php -v", then press Enter or Return. If you can't access the command line, you can createa quick script or WordPress.
🌐
Gcore
gcore.com › home › developers › how to check the php version
How to check your PHP version via CLI or PHP File | Gcore
April 8, 2025 - A Detailed Guide Explaining How to Verify the PHP Version on Your Server, Utilizing Either the Command Line Interface or a PHP File.
🌐
Codecourse
codecourse.com › articles › how-to-check-your-php-version-3-ways
How to Check Your PHP Version (3 Ways)
September 19, 2024 - The terminal is the easiest way to check which PHP version you're running. This requires no code to be written, just a simple command. ... You'll get an output similar to the following. You'll notice that this gives the PHP version with (cli) appended. Crucially, this means the version of the CLI (command line interface...
Find elsewhere
🌐
eUKhost
eukhost.com › home › how to check your php version via ssh
How to check your PHP version via SSH - eukhost
July 3, 2024 - Multiple PHP Versions– If your server supports multiple PHP versions, you may need to specify the path to the PHP binary. For example: ... This command will display the loaded configuration files and directories. PHP Information Page: For a more comprehensive view of your PHP configuration, you can create a phpinfo.php file in your web directory with the following content: ... Access this file via your web browser to see detailed PHP information. This way, you can check your PHP version via SSH.
🌐
Reddit
reddit.com › r/phphelp › how to check php version?
r/PHPhelp on Reddit: How to check PHP version?
November 4, 2023 -

hi, I'm new to PHP.

I want to change display_errors to On for debugging, but see many PHP versions installed.

I thought going to http://localhost/first/index.php?language=English&page=phpinfo would give me the version , but it just renders the regular index page.

Ty.

🌐
PHP
php.net › manual › en › function.phpversion.php
PHP: phpversion - Manual
More versioning information is available using the PHP_*_VERSION constants. ... Some extensions may define their own version number. However, most bundled extension will use the PHP version as their version number. ... If you're trying to check whether the version of PHP you're running on is sufficient, don't screw around with `strcasecmp` etc.
🌐
Cyfuture Cloud
cyfuture.cloud › kb › general › how-do-i-check-php-version-and-configuration
How Do I Check PHP Version And Configuration?
When making decisions concerning updates, installs, and settings, these factors would be crucial for anybody creating applications, managing systems, or just managing websites. This tutorial will walk you through the process of using the command line to find the PHP version and configuration. Let’s get started! 1. Open Terminal: You can find Terminal in your applications or search for it in the spotlight.
🌐
Beyond GTA Inc.
beyondgta.com › post › the-impact-of-php-version-and-how-to-check-it
The Impact of PHP Version and How to Check it
May 21, 2024 - 'php' is not recognized as an internal ... your operating system. First, determine your environment. Linux: Open a terminal and run php -v from the relevant directory....
🌐
Laravel Daily
laraveldaily.com › post › how-to-quickly-check-php-version-cli-nginx-laravel
How to Quickly Check PHP Version: CLI, NginX, Laravel
August 5, 2023 - Using the grep command, you can quickly identify each site's PHP version. ... From the socket in the output, we can see that they all run on PHP 8.1. /etc/nginx/sites-enabled/web1.test: fastcgi_pass unix:/opt/php/php8.1-fpm.sock; /etc/nginx...
🌐
FOSS Linux
fosslinux.com › home › ubuntu › how to check php version on ubuntu
Step-by-Step Guide: How to Check PHP Version on Ubuntu
August 4, 2023 - To check the PHP version, open up your Terminal. You can do this by searching for it in the ‘Show Applications’ menu or using the keyboard shortcut Ctrl + Alt + T.
🌐
ServerPilot
serverpilot.io › docs › php
PHP versions and settings | ServerPilot Documentation
The “Master Value” column shows the default PHP settings including any customizations to default PHP settings. To view PHP settings using the PHP CLI, use the -i flag: ... The output of php -i shows the server-wide settings for the PHP version ...
🌐
Tom McFarlin
tommcfarlin.com › the-browser-and-terminal-show-different-versions-of-php
The Browser and Terminal Show Different Versions of PHP | Tom McFarlin
June 20, 2019 - First, you need to know where Homebrew has installed PHP. This can be accomplished by running in which php the terminal. It should return something like this: And the corresponding version information, when running php -v should look like this:
Top answer
1 of 9
108

I use the following command to view installed PHP versions in Ubuntu:

sudo update-alternatives --list php

Second way go to php directory where all PHP version configuration file stored:

cd /etc/php 
dir 

Output:

 > 5.6  7.0  7.1
2 of 9
40

Since you have a Linux environment, you can run this on your console:

locate bin/php

And then for anything that looks like a PHP binary, get the version. The output for me for the above is:

/home/xx/Development/Personal/Project1/webapp/bin/phpunit
/home/xx/Development/Personal/Project1/webapp-backup/vendor/bin/phpunit
/home/xx/Development/Personal/Project2/app/vendor/bin/phpunit
/home/xx/php-threaded/bin/php
/home/xx/php-threaded/bin/php-cgi
/home/xx/php-threaded/bin/php-config
/home/xx/php-threaded/bin/phpize
/usr/bin/php
/usr/bin/php5
/usr/local/bin/php-cgi
/usr/local/bin/php-config
/usr/local/bin/php53
/usr/local/bin/phpize
/usr/sbin/php5dismod
/usr/sbin/php5enmod
/usr/sbin/php5query

Out of those, there are a few that look like PHP binaries. So let's get the version for each:

/home/xx/php-threaded/bin/php -v
/usr/bin/php -v
/usr/bin/php5 -v
/usr/local/bin/php53 -v

That will give you the versions of PHP you have installed.

I wouldn't bother deleting an old version, it might remove files that will stop things working. You can just configure the console version, or the Apache version, to use the version you want.


In answer to your supplementary question: it seems that you've followed the instructions here to add an unofficial repo to your version of Ubuntu, since the standard repo does not support 5.5.

We discovered together that the way to get it working was first to upgrade Apache from 2.2 to 2.4:

sudo apt-get upgrade apache2

It should be noted that this can cause some vhost repair to be required, as some Apache directives changed in this version. Once you have done that, you can get the new version of mod_php:

sudo apt-get install libapache2-mod-php5