Step-by-Step Guide: Installing PHP on Windows (2025 Updated)
Step-by-step PHP installation and configuration on Windows with Apache integration
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.
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.
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++)
Visit the official PHP website: https://windows.php.net/download/
Choose the latest Thread Safe version (suitable for Apache or Nginx).
Select the x64 or x86 version based on your system.
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.
After downloading, right-click the ZIP file and choose Extract All.
Extract it to a directory like:
C:\php
You’ll see several files, including php.exe, php.ini-development, and php.ini-production.
To make PHP accessible from the command line, you need to add it to the Windows PATH variable.
Open Control Panel → System → Advanced system settings.
Click Environment Variables.
Under System Variables, select Path, then click Edit.
Click New, and add the path to your PHP folder:
C:\php
Click OK on all windows to save.
Test it: Open Command Prompt and type:
php -v
You should see the installed PHP version.
php.ini File
The php.ini file controls PHP’s behavior.
In the PHP folder, locate:
php.ini-development
Rename it to:
php.ini
Open it in a text editor and make the following recommended changes:
Uncomment (remove the ;) from these lines:
extension_dir = "ext"
extension=mysqli
extension=curl
extension=gd
extension=mbstring
extension=openssl
extension=pdo_mysql
date.timezone = "Asia/Kolkata"
Tip: Set your timezone as per your location to avoid PHP date/time warnings.
If you already have Apache installed, you can configure it to work with PHP.
Open your Apache configuration file (httpd.conf).
Add the following lines at the end:
LoadModule php_module "C:/php/php8apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "C:/php"
Restart Apache using:
httpd -k restart
Create a test PHP file:
C:\Apache24\htdocs\info.php
Add:
<?php phpinfo(); ?>
Open your browser and visit:
http://localhost/info.php
If everything is configured properly, you’ll see the PHP information page.
Run PHP scripts directly in Command Prompt:
php myscript.php
This is useful for automation, testing, or running Composer (PHP package manager).
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.
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.