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

🌐
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) you're running and not necessarily the version you're running through your web server.
🌐
Host IT Smart
hostitsmart.com › manage › knowledgebase › 465 › check-php-version-in-windows-cmd.html
How to Check PHP Version in Windows CMD?
September 4, 2025 - Sometimes, running php -v may show an error like ‘php’ is not recognized as an internal or external command. This means PHP is either: ... Installed but not added to the Windows PATH environment variable.
🌐
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.

🌐
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.
Find elsewhere
🌐
YouTube
youtube.com › watch
How to CHECK PHP Version in CMD (Step by Step) 2025 - YouTube
Need to verify which version of PHP is installed on your system? This step-by-step tutorial shows you how to check your PHP version using Command Prompt (CMD...
Published   April 7, 2025
🌐
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 - If you have command line access on the server on which PHP is installed, you can check the PHP version using the command php -v. If the server is remote, you may need to SSH in. First, open your command line interface: Windows Command Prompt: ...
🌐
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.
🌐
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 - Open the terminal prompt and then type the following commands. Login to the remote server using the ssh command. For example: ssh user@linux-unix-server-ip · To check PHP version, run: php --version OR php-cgi --version
🌐
CyberPanel Community
community.cyberpanel.net › support and discussion › general discussion
How check php version installed? - General Discussion - CyberPanel Community
March 13, 2018 - I tried this command: php -i and php -v but i said: -bash: php : command not found where i’m doing mistake?
🌐
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 - 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). The installed PHP version will be displayed on the first line of the resulting page.
🌐
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...
🌐
H2S Media
how2shout.com › home › php › how to know if php is installed on windows?
How to know if PHP is installed on Windows? - H2S Media
March 6, 2023 - After finding the folder, select it and press the OK button. Now, open the command prompt or PowerShell to run the common php -v command for showing the version-related details. Another way to check the version of PHP on Windows 11 or 10 is ...
🌐
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 - # Example command to navigate to the PHP installation location cd /usr/local/bin · After this, running php -v will correctly display the PHP version.
🌐
Namecheap
namecheap.com › support › knowledgebase › article.aspx › 9397 › 2219 › how-to-check-php-version-and-configuration
How to check PHP version and configuration - Hosting - Namecheap.com
Another way to check PHP version is PHPinfo() function, commonly used to check the current state of PHP configuration. It can also be used for debugging purposes as it contains all EGPCS (Environment, GET, POST, Cookie, Server) data.
🌐
PHP
php.net › manual › en › function.phpversion.php
PHP: phpversion - Manual
Note that the version string returned by phpversion() may include more information than expected: "5.5.9-1ubuntu4.17", for example. ... To know, what are the {php} extensions loaded & version of extensions : <?php foreach (get_loaded_extensions() as $i => $ext) { echo $ext .' => '. phpversion($ext).
🌐
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.