How to Install PHP on Windows PC (Beginner Guide)

Introduction

Are you trying to install PHP on your Windows computer but don’t know where to start?
Don’t worry — in this easy-to-follow guide, I’ll show you step-by-step how to install PHP on Windows, set it up correctly, and verify the installation. 

Whether you are learning web development, setting up a local server, or using Composer, PHP installation is a must.

Let’s dive in! 🚀

Why Install PHP on Windows?

PHP is a popular programming language used to build websites, web applications, and run powerful server-side scripts.
Installing PHP on your local Windows PC allows you to:

  • Develop and test PHP websites locally

  • Run tools like Composer (PHP dependency manager)

  • Practice PHP coding without needing a live server

Step-by-Step Guide to Install PHP on Windows

Step 1: Check if PHP is Already Installed

Before installing, let’s check if PHP is already available on your system.

    1. Press windows + R, type cmd, and hit Enter to open Command Prompt.

    2. Type the following command:

      bash
      php -v
      If PHP is installed, you will see something like:
      cmd
      PHP 8.4.6 (cli) (built: Apr  9 2025 09:45:13) (NTS Visual C++ 2022 x64)
      Copyright (c) The PHP Group
      Zend Engine v4.4.6, Copyright (c) Zend Technologies
      Or if you see an error like:
      cmd
      'php' is not recognized as an internal or external command, operable program or batch file.
      
      It means PHP is not installed yet — so let’s install it!

Step 2: Download PHP for Windows

  1. Visit the official PHP downloads page: 👉 https://windows.php.net/download/
  2. Under the latest PHP version, find the Windows downloads section.
  3. Choose the version:
  4. x64 Thread Safe or x64 Non Thread Safe (for beginners, any is fine — but Thread Safe is usually safer for local servers).
  5. Click to download the ZIP file (example: php-8.4.6-nts-Win32-vs17-x64.zip).

Step 3: Extract PHP Files

    1. Once downloaded, right-click on the ZIP file and select Extract All.

    2. Extract it into a folder, for example:

      makefile
      C:\php
      (You can create a new folder named php inside the C drive.)

Step 4: Add PHP to Windows Environment Variables

To use PHP commands globally from any folder, you need to add it to your system’s PATH.

    1. Press windows + S, type Environment Variables, and open Edit the system environment variables.

    2. In the System Properties window under the Advanced tab, click Environment Variables.

    1. 3. In the System variables section:

      • Find and select Path, then click Edit.

    1. 4. Click New, and paste the location (C:\php) where you extracted PHP:

    1. 5. Click OKOKOK to save changes.

✅ Now PHP is available system-wide!

Step 5: Verify PHP Installation

Let’s double-check that PHP is now installed properly.

    1. Open Command Prompt again.

    2. Type:

      bash
      php -v

      If everything was done correctly, you will see PHP’s version information like:

      cmd
      PHP 8.4.6 (cli) (built: Apr  9 2025 09:45:13) (NTS Visual C++ 2022 x64)
      Copyright (c) The PHP Group
      Zend Engine v4.4.6, Copyright (c) Zend Technologies

      Congratulations! 🎉 You have successfully installed PHP on your Windows PC.

Frequently Asked Questions (FAQs)

1. What is PHP used for?

PHP is a server-side scripting language used to create dynamic websites, web applications, and APIs. Popular platforms like WordPress are built using PHP.

2. Is PHP free to use?

Yes, PHP is completely free and open-source!

3. Can I install PHP using XAMPP or WAMP?

Yes! XAMPP and WAMP are bundles that install PHP, MySQL, and Apache together. However, in this guide, we manually installed only PHP for more control.

4. How do I update PHP later?

You can update PHP by downloading the newer version from the PHP official website and replacing the old files. Don’t forget to update your environment variables if needed.

Final Words

Installing PHP on Windows is not complicated when you follow the correct steps.
With PHP installed, you can now start learning PHP programming, set up local development environments, or install tools like Composer!

Download PHP → Extract → Add to Path → Verify — and you’re ready to go!


Would you also like me to give a sample Hello World PHP file you can create to test your installation visually? 🚀
(It will just take a few seconds!) 🌟
Should I include that too?

Leave a Reply

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

Popular Tags

Need Help?