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
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 - The terminal outputs the PHP version currently installed on your system.
🌐
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....
🌐
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 - Are you using php-fpm? Get php version using the php-fpm -v or php-fpm73 -v or php-fpm83 -v command. Let us see all commands and examples in details to check php version.
🌐
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.
🌐
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.

Find elsewhere
🌐
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 - Inside this file, use the phpinfo() function: ... 3. In your web browser, navigate to https://your-server/phpinfo.php (be sure to replace “your-server” with your server’s IP address or domain name).
🌐
Simplified
simplified.guide › php › check-version
How to check PHP version
$ php -i | grep "PHP Version" PHP Version => 7.4.3 PHP Version => 7.4.3
🌐
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...
🌐
TecAdmin
tecadmin.net › check-php-version
How to Check PHP Version (Apache, Nginx and CLI) – TecAdmin
April 26, 2025 - Here we used built-in phpinfo() function, which prints the active PHP version details: ... Press “CTRL +X” and hit Enter button. Then press ‘Y’ and again hit Enter to save and exit from text editor.
🌐
Codecourse
codecourse.com › articles › how-to-check-your-php-version-3-ways
How to Check Your PHP Version (3 Ways)
September 19, 2024 - Crucially, this means the version of the CLI (command line interface) you're running and not necessarily the version you're running through your web server. Usually, these do match up, so it's a good indicator of the version you're actually on. Another way to do this is by running php -i' which will dump the information about your PHP installation.
🌐
The Geek Diary
thegeekdiary.com › how-to-check-the-php-version-on-linux
How to check the PHP version on Linux – The Geek Diary
There are several possibilities to check and validate PHP version on Linux. 1. Open a bash shell terminal and use the command “php –version” or “php -v” to get the version of PHP installed on the system.
🌐
PHP
php.net › manual › en › function.phpversion.php
PHP: phpversion - Manual
It's defined as used in the above * expression: * * $version_id = $major_version * 10000 + $minor_version * 100 + $release_version; * * Now with PHP_VERSION_ID we can check for features this PHP version * may have, this doesn't require to use ...
🌐
Envato Tuts+
code.tutsplus.com › home › php › php scripts
How to Check the PHP Version | Envato Tuts+
June 30, 2020 - There are a few different ways to check the PHP version. Mainly, if you have SSH access to your server, you can use the command-line interface to check it. On the other hand, if you don’t have terminal access, I’ll show you how to check the PHP version using the phpinfo function.
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
🌐
eUKhost
eukhost.com › home › how to check your php version via ssh
How to check your PHP version via SSH - eukhost
July 3, 2024 - This article explains how to check your PHP version via SSH. It is essential for ensuring compatibility with your applications and for security purposes. ... Use an SSH client like PuTTY (for Windows) or Terminal (for macOS/Linux).
🌐
Cyfuture Cloud
cyfuture.cloud › kb › general › how-do-i-check-php-version-and-configuration
How Do I Check PHP Version And Configuration?
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.
🌐
Linux TLDR
linuxtldr.com › home › how to check php version in linux (via 4 methods)
How to Check PHP Version in Linux (via 4 Methods)
February 20, 2025 - Then, you have two options: either run the PHP server and access the PHP file in your web browser to check the PHP version, or pass the PHP file to the absolute path of the PHP binary file and use the grep command to find the PHP version.