Step-by-Step Guide: Installing PHP on Windows (2025 Updated)

10/24/2025
All Articles

Step-by-step PHP installation and configuration on Windows with Apache integration

Step-by-Step Guide: Installing PHP on Windows (2025 Updated)

Step-by-Step Guide: Installing PHP on Windows (2025 Updated)

PHP is one of the most popular server-side scripting languages used for web development. It powers millions of websites and web applications, including WordPress, Drupal, and Laravel-based projects. If you’re setting up a local development environment or deploying a PHP-based website, knowing how to install PHP on Windows is essential.

In this step-by-step guide, we’ll walk you through everything you need to install, configure, and run PHP on Windows — whether standalone or with web servers like Apache or Nginx.


Why Install PHP on Windows?

Installing PHP on Windows gives you the flexibility to:

  • Develop and test PHP projects locally.

  • Run dynamic web applications using WAMP (Windows, Apache, MySQL, PHP).

  • Use PHP for scripting and automation.

  • Integrate PHP with web servers or frameworks.


Prerequisites

Before you start, ensure the following:

  • Windows 10 or later (64-bit recommended)

  • Administrator privileges

  • Internet connection

  • A text editor (like Visual Studio Code or Notepad++)


🪜 Step-by-Step Installation of PHP on Windows

Step 1: Download PHP for Windows

  1. Visit the official PHP website: https://windows.php.net/download/

  2. Choose the latest Thread Safe version (suitable for Apache or Nginx).

  3. Select the x64 or x86 version based on your system.

  4. Download the ZIP file (not the installer).


Tip: The “Thread Safe” version is needed when using PHP with Apache; “Non Thread Safe” is used for IIS or command-line execution.


Step 2: Extract the PHP Files

  1. After downloading, right-click the ZIP file and choose Extract All.

  2. Extract it to a directory like:

    C:\php
    
  3. You’ll see several files, including php.exe, php.ini-development, and php.ini-production.


Step 3: Configure the PHP Environment

To make PHP accessible from the command line, you need to add it to the Windows PATH variable.

Steps:

  1. Open Control Panel → System → Advanced system settings.

  2. Click Environment Variables.

  3. Under System Variables, select Path, then click Edit.

  4. Click New, and add the path to your PHP folder:

    C:\php
    
  5. Click OK on all windows to save.

Test it: Open Command Prompt and type:

php -v

You should see the installed PHP version.


Step 4: Configure the php.ini File

The php.ini file controls PHP’s behavior.

  1. In the PHP folder, locate:

    php.ini-development
    
  2. Rename it to:

    php.ini
    
  3. Open it in a text editor and make the following recommended changes:

Enable Common Extensions:

Uncomment (remove the ;) from these lines:

extension_dir = "ext"
extension=mysqli
extension=curl
extension=gd
extension=mbstring
extension=openssl
extension=pdo_mysql

Set Timezone:

date.timezone = "Asia/Kolkata"

Tip: Set your timezone as per your location to avoid PHP date/time warnings.

Step 5: Integrate PHP with Apache (Optional)

If you already have Apache installed, you can configure it to work with PHP.

Steps:

  1. Open your Apache configuration file (httpd.conf).

  2. Add the following lines at the end:

    LoadModule php_module "C:/php/php8apache2_4.dll"
    AddHandler application/x-httpd-php .php
    PHPIniDir "C:/php"
    
  3. Restart Apache using:

    httpd -k restart
    
  4. Create a test PHP file:

    C:\Apache24\htdocs\info.php
    

    Add:

    <?php phpinfo(); ?>
    
  5. Open your browser and visit:

    http://localhost/info.php
    

If everything is configured properly, you’ll see the PHP information page.


Step 6: Test PHP on Command Line

Run PHP scripts directly in Command Prompt:

php myscript.php

This is useful for automation, testing, or running Composer (PHP package manager).


Optional: Using PHP with WAMP or XAMPP

If you prefer an all-in-one installer, you can use:

  • WAMP – Includes Apache, MySQL, and PHP.

  • XAMPP – Includes Apache, MariaDB, PHP, and Perl.

These tools simplify PHP setup on Windows and are ideal for beginners.


Final Conclusion

Installing PHP on Windows is a straightforward process, whether for local development or server deployment. Once installed, you can run PHP scripts, build dynamic websites, or connect to databases like MySQL or PostgreSQL.

For more advanced setups, you can integrate PHP with frameworks like Laravel or Symfony and use tools like Composer for dependency management.

Article