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.
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
Click the Edit the system environment variables
If you used the second method you'll see this, (either way will get you there).
This will bring up the System Properties menu on the Advanced tab
Click the Environment Variables button at the bottom right.
The next screen will bring you to where you can edit your environment 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.
So this completes the install. So on to Step 3
Step 3. Test the Installation.
Open CMD or PowerShell elevated (Run as Adminstrator).
If you get this, your PHP installation and Environment Variable set up was successful.
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.
This page was published on