How to Install PHP on Windows 11 (Step-by-Step Guide)

Installing PHP on Windows 11 takes under 10 minutes and requires no prior experience. Whether you are building a local WordPress environment, testing a script, or setting up a full development stack, this guide walks you through every step from download to verification.

Step-by-step guide to install PHP on Windows 11 showing Command Prompt with PHP version output

Prerequisites

Before you start, make sure you have:

  • Windows 11 (64-bit) with administrator access
  • Basic familiarity with opening Command Prompt

This guide walks you through installing PHP 8.x — the latest stable major version. Only choose PHP 7.4 if your legacy project specifically requires it.

Step 1: Download PHP to Install on Windows 11

Go to the official PHP downloads page at windows.php.net/download. Download the latest PHP 8.x Non-Thread Safe (NTS) ZIP for x64 Windows.

Thread Safe vs Non-Thread Safe — Which Should You Pick?

  • Non-Thread Safe (NTS) — Choose this for CLI use and single-threaded servers. It works best for most local development setups.
  • Thread Safe (TS) — Choose this only if you run Apache with its multi-threaded worker MPM.

When in doubt, pick NTS — it is the right choice for most Windows 11 setups.

Step 2: Extract and Place the PHP Folder

Extract the ZIP file you downloaded. Rename the folder to php and move it to the root of your C drive:

C:\php

Keep the path short and clean. A path like C:\php avoids spaces in directory names and saves you trouble in the next steps.

Step 3: Add PHP to Your Windows Environment Variables

You need to add PHP to your system PATH so you can run php commands from any terminal window. Here is how to do it:

  1. Press Win + S, search for Environment Variables, and open Edit the system environment variables.
  2. Click Environment Variables at the bottom of the dialog.
  3. Under System variables, select Path and click Edit.
  4. Click New and type C:\php.
  5. Click OK on all open dialogs to save your changes.

Verify Your PATH Update

Open a new Command Prompt window and run:

echo %PATH%

Check the output for C:\php. If you see it, you are ready to move on.

Step 4: Configure Your php.ini File

PHP includes two sample configuration files. You need to activate one before PHP can use it:

  1. Open C:\php in File Explorer.
  2. Rename php.ini-development to php.ini.

Enable the Extensions You Need

Open php.ini in any text editor. Find the extensions section and remove the leading ; (semicolon) from these lines to enable them:

;extension=curl
;extension=mbstring
;extension=openssl
;extension=pdo_mysql

These four extensions power most PHP frameworks and WordPress. Enable them now to avoid issues later.

Step 5: Verify Your PHP Installation

Now that you install PHP on Windows 11, confirm everything works. Open Command Prompt and run:

php -v

You should see output similar to:

PHP 8.3.x (cli) (built: ...) (NTS)

If you see this, your PHP installation is working correctly. You are all set.

Verify Your Extensions Are Working

Checking php -v confirms PHP runs. This command confirms your extensions loaded correctly:

php -m

Output (partial):

curl
mbstring
openssl
pdo_mysql

If any extension is missing from the list, the semicolon is still in front of it in php.ini. Open the file again, remove the ;, save, and run php -m again.

Test cURL specifically – it powers most HTTP requests, scraping scripts, and API calls in PHP:

php -r "var_dump(curl_version()['version']);"

Output:

string(6) "8.7.1"

If you see a version string, cURL is working. If you see a fatal error, cURL didn’t load – check the php.ini extension line again.

Troubleshooting Common Errors

  • “php is not recognized” — You did not save the PATH correctly, or you are still using the old terminal window. Repeat Step 3 and open a fresh Command Prompt.
  • Missing DLL error — You need to install the Visual C++ Redistributable that matches your PHP version.

Optional: Use XAMPP for an Easier Setup

If you also need Apache and MySQL alongside PHP, download XAMPP. It bundles all three tools into a one-click installer – you skip the manual PATH configuration entirely. The trade-off is that you get less control over individual component versions. If you are a complete beginner, XAMPP is a great starting point.

Before installing any PHP version, also install the Visual C++ Redistributable that matches your PHP build. Missing this is the most common cause of DLL errors on a fresh Windows setup.

Conclusion

You now know exactly how to install PHP on Windows 11. You have added PHP to your system PATH and configured php.ini with the essential extensions. Your machine is ready for local PHP development.

Take the next step and build your first project: How to Create Your First PHP Project on Windows 11 →

Frequently Asked Questions

Which PHP version should you install on Windows 11?

Install the latest PHP 8.x stable release. You get better performance and modern language features out of the box. Only fall back to PHP 7.4 if your specific legacy application requires it.

Do you need a web server to run PHP on Windows?

No, you do not. You can run any PHP script directly from Command Prompt with php filename.php. For web development, start PHP’s built-in server with php -S localhost:8000 — no Apache needed.

Why does Windows not recognize the php command after installation?

You most likely did not save the PHP path to your system PATH variable, or you did not restart Command Prompt after making the change. Go back to Step 3, confirm C:\php is in the list, save, and open a fresh terminal window.

Can you run multiple PHP versions on the same Windows 11 machine?

Yes, you can. Place each version in its own folder – for example, C:\php8 and C:\php7. Switch between them by updating the PATH variable to point to whichever version you need.

Do I need to install Composer separately on Windows 11?

Yes. Composer is PHP’s dependency manager and it installs separately from PHP itself. Once PHP is working on your PATH, download the Composer installer from getcomposer.org and run it. It detects your PHP installation automatically. After that composer works from any Command Prompt window the same way php does.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top