How to Install PHP on Windows 11

Install PHP on Windows 11 step by step, connect it to Apache, configure php.ini, and start running PHP locally.

PHP Beginner Updated: May 2, 2026
How to Install PHP on Windows 11
STEP 01

Download PHP

Download the latest PHP x64 Thread Safe ZIP package from:
https://windows.php.net/download/

STEP 02

Extract

Extract all to C:\php

STEP 03

Configure Apache

Open Apache config file at:

C:\Apache24\conf\httpd.conf

Add the following to the top of the file:

httpd.conf
LoadModule php_module "c:/php/php8apache2_4.dll"
AddHandler application/x-httpd-php .php
PHPIniDir "c:/php"
STEP 04

Restart Apache

Option 1:
Open Services, find Apache 2.4 - right click - Restart

Option 2:
Open the Command Prompt as an Administrator:

CMD
C:\Windows\System32>net stop "Apache2.4"

The Apache2.4 service was stopped successfully.

CMD
C:\Windows\System32>net start "Apache2.4"

The Apache2.4 service was started successfully.

STEP 05

Configure PHP

PHP’s configuration file is php.ini. This doesn’t exist initially, so copy:

C:\php\php.ini-development

to

C:\php\php.ini

You can edit php.ini in a text editor, and you may need to change lines such as those suggested below (use search to find the setting). In most cases, you’ll need to remove a leading semicolon (;) to uncomment a value.

First, enable any required extensions according to the libraries you want to use. The following extensions should be suitable for most applications including WordPress:

php.ini
extension=curl
extension=gd
extension=mbstring
extension=mysqli
extension=pdo_mysql
extension=openssl
extension=zip

Change the default index to index.php:

php.ini
<IfModule dir_module>
    DirectoryIndex index.php index.html
</IfModule>
STEP 06

Add C:\php to the PATH environment variable

To ensure Windows can find the PHP executable, you must add it to the PATH environment variable.

Click the Windows Key button and type “env”, press Enter. Select the Advanced tab, and click the Environment Variables button.

Scroll down the System variables list and click Path, followed by the Edit button. Click New and add C:\php.

Now OK your way out. You shouldn’t need to reboot, but you may need to close and restart any CMD terminals you have open.

STEP 07

Greetings, World!

Create a new file called greetings.php in Apache htdocs directory with this code:

php
<?php
echo "Greetings, World!;"
?>

Open up Command Prompt and type:

cmd
cd C:\Apache24\htdocs
php greetings.php

Greetings, World!

Life Craft Alatyr symbol
Part of the Life Craft Network
Life Craft
Body Mind Spirit Craft
Enter the Guild →