Installing PHP 8 on Windows 11

  1. Download PHP 8
  2. Extract PHP
  3. Rename and Configure php.ini
  4. Configure Apache to Use PHP
  5. Test PHP Installation

Download PHP 8

Extract PHP

Extract the ZIP file to:

1
D:\php-8.4.2-Win32-vs17-x64

Rename and Configure php.ini

Inside D:\php-8.4.2-Win32-vs17-x64, rename php.ini-development to php.ini.

Open php.ini in a text editor and configure the following:

Uncomment and modify important lines:

1
extension_dir = "D:/php-8.4.2-Win32-vs17-x64/ext"

Enable essential extensions:

1
2
3
4
5
6
extension=curl
extension=mbstring
extension=mysqli
extension=openssl
extension=pdo_mysql
extension=gd

Configure Apache to Use PHP

Locate and open the Apache config file, add the following lines at the end of the file:

1
2
3
4
# PHP 8 Configuration
PHPIniDir "D:/php-8.4.2-Win32-vs17-x64"
LoadModule php_module "D:/php-8.4.2-Win32-vs17-x64/php8apache2_4.dll"
AddHandler application/x-httpd-php .php

Add index.php to the DirectoryIndex if not already there:

1
DirectoryIndex index.php index.html

Test PHP Installation

Create a test PHP file info.php in your Apache htdocs directory:

1
2
3
<?php
phpinfo();
?>

Restart Apache then open a browser and navigate to:

1
http://localhost/info.php