How to know if PHP is installed on Windows?

PHP is powering hundreds of websites & web applications around the world, and although most of the time it is used on Linux, we can install PHP on Windows 11 or 10 as well. However, after completing the setup or implementing any new version of PHP, it is essential to find out which version of PHP is running on your Windows system.

It helps to confirm the web application we are using on our Windows Desktop or Server has satisfied the PHP requirements it needed.

In this quick tutorial, we will find out the way to check the PHP version running on our Windows using the command line.

How to Check PHP version on Windows 10 or 11

Before following the tutorial, make sure PHP has been configured properly on your Windows system. Apart from that you need a command prompt or terminal access

If you don’t have this programming language on your system yet then see our tutorial on how to install PHP on Windows using the command prompt.

Check the PHP version using Command prompt or Powershell

The best and easiest way to identify the installed PHP version is by using its command line tool. However, to use the user must have access to the Windows command line apps like CMD.

Go to Windows 10 or 11 search box and type CMD or Powershell. You can use any of them. As the icon appears on any of these tools, click on it to run.

Run the given php the command that will help you to check the installed PHP version on Windows 10/11 or any other edition you are using:

php -v

or 

php -version

The above command is not just limited to Windows only, even other operating systems users such as Linux or MacOS can use it. As you run the syntax, in return the version and the technical details will be given.

However, the command will only show the default version on the system, not all the available ones, if you have installed multiple.

PHP is not recognized as an internal or external command

Sometimes, if you run the PHP -v and get an error saying PHP is not recognized as an internal or external command on Windows prompt or PowerShell then most probably the installed PHP location is not added in your system’s path.

So, first, open the C drive and find out the path of PHP. By default, it will be: C:\Program Files\php\php.exe however, we have used the Choco to install it, therefore our default path is C:\tools\php

Once you confirmed the location, open the system variables window. For that, go to the search box and type – Edit the system environment variables 

Click on it, as the option is available in the search result.

Edit the system environment variables

Soon the System Properties will open, here you have to click on the “Environment Variables…” button.

add php to environment variable in Windows

Select the Path from the System Variables area and click on the Edit button to get further options for adding the PHP-installed folder path in your Windows.

Add the system PATH in Windows

Finally, click on the Browse button and navigate to the folder where the PHP is located.

write Environment variables in window search

After finding the folder, select it and press the OK button.

Browse PHP installed folder

Now, open the command prompt or PowerShell to run the common php -v command for showing the version-related details.

Create a PHP Info () page on Windows

Another way to check the version of PHP on Windows 11 or 10 is by using a single line of code that will display all the necessary information including extensions and their versions.

For that on your command prompt or terminal type:

notepad info.php

After that paste the following code and save and close the file.

Create PHP Info file on Windows

Now, you may not know PHP comes with its own web server that we can use to test our PHP-based applications. So, in the same directory where you have created the info.php run:

php -S localhost:8000

Php inbuilt web server

You will see the PHP’s inbuilt web server will be started on your current Windows command prompt. Now, open your browser and type:

http://localhost:8000/info.php
And you will see a piece of detailed information about your installed PHP version.

PHP Info check version