If you are a developer or working with PHP-based applications like WordPress, Laravel, or Joomla, it’s important to know which version of PHP is installed on your system. This is because different frameworks and CMSs require specific PHP versions to work smoothly.
In this detailed guide, we will walk you through the step-by-step process of checking the PHP version in Windows CMD (Command Prompt) in a beginner-friendly manner.
Also Read: Guide to Check Node Version in Windows CMD
Why Do You Need to Check the PHP Version?
Before moving to the steps, here’s why checking the PHP version is useful:
➔ To make sure your applications are compatible with the installed PHP version.
➔ To troubleshoot errors caused by older PHP versions.
➔ To confirm if PHP is installed and properly configured in your Windows system.
➔ To plan an upgrade if your version is outdated.
Also Read: How to Change the PHP Time Zone Using php.ini?
Steps to Check PHP Version in Windows CMD
Follow these steps to check the installed PHP version on your Windows machine using Command Prompt:
➔ To open Windows CMD, press Windows Key + R on your keyboard.
➔ A dialog box will open. In that, Type ‘cmd’ in it & press ‘Enter.’ This will open the Command Prompt window.
➔ Once it is open, type the following command and press ‘Enter’:
php -v |
After running the above command, you will see output like this:

As shown in the image, PHP 8.1.33 is the installed version.
What If You Get an Error?
Sometimes, running php -v may show an error like ‘php’ is not recognized as an internal or external command. This means PHP is either:
- Not installed, or
- Installed but not added to the Windows PATH environment variable.
How to Fix?:
You just have to add PHP to the System PATH
➔ You need to locate the folder where PHP is installed (typically in C:\xampp\php or C:\Program Files\php).
➔ You have to copy the path by right-clicking on it.

➔ After that, you have to type ‘Environment’ in the search menu.

➔ In that, click on ‘Edit the system environment variables.’

➔ Click on ‘Environment Variables’

➔ Under System variables, find the variable named ‘Path.’ & double click on it.

➔ In that, click on ‘New’ and paste the PHP installation directory path.

➔ Click ‘OK’ to save the changes.

➔ Restart the Command Prompt and run this command: ‘php -v’.
Now, it should display the PHP version.
Also Read: How can you connect to a Remote Desktop using CMD?
Conclusion
Checking your PHP version in Windows CMD is not just about knowing a number; it helps you ensure your applications run smoothly, stay secure, and remain compatible with the latest features.
If you see the version number using php -v, it means PHP is installed and working correctly.
If you encounter an error, don’t worry; simply add PHP to your system PATH or reinstall it.
Once you know your PHP version, you can decide whether to upgrade to a newer version for better speed, security, and compatibility with modern frameworks like WordPress, Laravel, or Drupal.