The purpose of this article is to provide instructions for installing PHP on Windows 11. However, this is nearly identical for Windows 10.

Step 1. Download PHP for Windows

Go to the PHP Downloads page
A couple of notes - as of this writing, PHP is at version 8.1.11. Also the download screen shot below is showing the options for x64 downloads which is the platform I'm using. Right below that are the same x86 download links if you prefer 32 bit. Also note there is a "Non Thread Safe" download and a "Thread Safe" download. (ref 1)

PHP is available either as Thread Safe and Non Thread Safe. In simple terms, we can use Thread Safe PHP if we are using mod_php as worker MPM in Apache which spans multiple threads concurrently to process the requests and Non Thread Safe can be used for CGI. The Thread Safe version is required for web servers running in a multithreaded context.

Choose the zip file of your choice. Save it to your computer then extract it and save the extracted files to an easy location to get to (for example I extracted mine to D:\PHP). I recommend an easy path because Windows will not recognize your PHP installation until you set environment variables in the next step and using a simple path makes that process easier.

PHP Download Options

Step 2. Set your Environment Variable

Sometimes it's hard to find system settings on Windows 10 and 11 that we've been used to. However, if you happened to have read my article on God Mode Control Panel and installed it, you can open it and search for Environment Variables. If you don't have God Mode Control Panel set up you can click the Windows start button and in the search type environment

God Mode Environment Variables

Click the Edit the system environment variables

If you used the second method you'll see this, (either way will get you there).

Win env var

This will bring up the System Properties menu on the Advanced tab

System Properties

Click the Environment Variables button at the bottom right.

The next screen will bring you to where you can edit your environment variables.

edit variables

There are two options here. You can change this in the first box, but it will only be available to the current logged in user. The better option is to change in the System Variables box as it will apply to any user. In this case I have already changed it in System Variables. You can see this partially in the screenshot above in PATHEXT (which stands for Path Extension and you can see where I edited that and added .PHP at the end. The other to edit is Path. When you click Path and click edit, you can add or edit any paths. In this screen shot you can see that I added the path to my PHP installation at the bottom.

php extension

So this completes the install. So on to Step 3

Step 3. Test the Installation.

Open CMD or PowerShell elevated (Run as Adminstrator).
Type php --version
If you get this, your PHP installation and Environment Variable set up was successful.

Successful PHP Install

If you get the error 'php' is not recognized as an internal or external command, operable program or batch file., it wasn't. Go back and double check the instructions for what you may have missed.

Credits

(ref 1) https://php.tutorials24x7.com/blog/how-to-install-php-8-on-windows

This page was published on It was last revised on

2

1 Comment

  • Votes
  • Oldest
  • Latest
BO
443 9
Commented
Updated

I use XAMPP, which installed PHP with it as I was installing it. The issue I somewhat recently got into though is upgrading PHP. I ended up reinstalling XAMPP with the latest PHP version rather than simply updating PHP. I'm actually thinking about getting away from XAMPP and get into Laragon where I hear these types of things are much simpler. Thanks for this walk-through.

Looked through that link you provided and they have a step-by-step walk through of how to update PHP in XAMPP.

  • 0
    Bogey, it would be great to see updates on what you end up doing and how it all works out for you. — Mark Bowker
add a comment
2