How to Install PHP 8 On Windows: Without XAMPP

In this tutorial, we will go through the process of installing PHP 8.x and above on Windows without using XAMPP.

How to Install PHP 8 On Windows: Without XAMPP

PHP is a popular scripting language widely used for web development. Traditionally, most of us would use an all-in-one package like XAMPP or WAMP, which includes Apache, MySQL, PHP, and several other software to run a complete web server on their machines.

However, there might be situations where you want to install PHP standalone, separate from other software. One such reason might be to have a different version of PHP than what's bundled in your current XAMPP or WAMP. The advantage is that you get a lighter installation with only the components you need.

Requirements

  • Windows 10 and above.
  • Administrator access on your computer

Method 1 - Using Scoop

The first and the method that we recommended of installing PHP on Windows is by using the scoop package manager.

If you do not have scoop installed, you can check the tutorial below:

How to Install Scoop on Windows
In this post, we will quickly go over how you can quickly install and configure Scoop package manager on Windows in easy steps.

Once installed, run the command below to install PHP on your Windows machine:

scoop install php

This should download the latest available version of PHP and install it on your machine. You can use the command below to check the installed version:

php --version

Output:

PHP 8.2.7 (cli) (built: Jun  7 2023 10:25:38) (ZTS Visual C++ 2019 x64)
Copyright (c) The PHP Group
Zend Engine v4.2.7, Copyright (c) Zend Technologies

In this case, we have PHP version 8.2.7 installed.

Method 2 - Using Chocolatey Package Manager

The second method you can use to install PHP as a standalone unit in Windows is using the chocolatey package manager.

If you do not have Chocolatey installed, you can check the resource below:

How to Install Chocolatey on Windows 11
In this tutorial, we will discuss how to quickly setup Chocolatey package manager on the latest version of Windows.

Once installed, run the command below to install PHP:

choco install php

Similarly, the command above should grab the latest available PHP version and install it on your machine.

Method 3 - Manual Install

You can also manually download the PHP archive and configure it on your machine.

Download PHP 8

Go to the PHP for Windows download page at https://windows.php.net/download

Under the VC16 x64 Non Thread Safe or VC16 x86 Non Thread Safe (depending on whether your Windows is 64-bit or 32-bit) of the PHP 8 section, click on the Zip link to download the PHP 8.0 zip package. If you are unsure, it is likely you are using a 64-bit version of Windows.

image-20230627081251603

Extract the PHP 8 Zip Package

After the download completes, navigate to your downloads directory, right-click on the PHP zip package, and select Extract All...

image-20230627081611746

Choose where you want to extract PHP. A common location would be C:\php, so the PHP binaries would be in C:\php. Make sure the path does not contain any spaces.

image-20230627081650502

Click Extract

Rename php.ini File

Navigate to the directory where you extracted PHP (e.g., C:\php).

image-20230627081740709

3.2. Find a file named php.ini-development and rename it to php.ini.

Edit System Environment Variables

Open the Environment Variables by searching env in the Windows Start Menu.

image-20230627082250102

Under 'Startup and Recovery' , choose the 'Environment variables' option.

image-20230627082414336

Under 'System variables', scroll down and find the 'Path' variable, then click on 'Edit...'.

image-20230627082454619

In the 'Edit Environment Variable' window, click 'New' and then add the path to your PHP installation (e.g., C:\php).

Click 'OK' to close all windows.

image-20230627082551556

Step 5: Verify the PHP Installation

Open a new command prompt window (to make sure it gets the new environment variable you just added).

Enter the commandphp -v and hit 'Enter'. You should see a message showing the PHP version number.

Conclusion

In this post, you discovered the various methods you can use to install and configure PHP as a standalone unit on Windows systems.

Table of Contents
Great! Next, complete checkout for full access to GeekBits.
Welcome back! You've successfully signed in.
You've successfully subscribed to GeekBits.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info has been updated.
Your billing was not updated.