Programming

How to Install PHP 8.5 on Windows — Step-by-Step Guide for Beginners

How to Install PHP 8.5 on Windows — Step-by-Step Guide for Beginners
Table of Contents

You typed php -v and Windows answered: “php is not recognized as an internal or external command.” Frustrating, right?

Don’t worry. Installing PHP on Windows has only a few steps, and the hard part is just knowing which file to download and where to click. In this guide you will install PHP 8.5, add it to your PATH, and run your first PHP script, with a picture for every step.

What you will have at the end (about 10 minutes):

✓ PHP 8.5 installed in C:\PHP
✓ php working from any folder in Command Prompt
✓ A working php.ini with the common extensions on
✓ Your first PHP script and a local web server running

Quick Roadmap

STEP 1Download PHP 8.5
STEP 2Extract to C:\PHP
STEP 3Set up php.ini
STEP 4Add PHP to PATH
STEP 5Test it

Before you start: PHP for Windows needs the Microsoft Visual C++ Redistributable (2015-2022, x64). Most PCs already have it. If you later see an error about VCRUNTIME140.dll, install it from Microsoft and try again.

STEP 1

Download PHP 8.5 for Windows

Open windows.php.net/download. This is the official site for Windows builds of PHP, so you can trust it. Scroll down to the PHP 8.5 section.

You will see several options, and this is where beginners get confused. Here is the simple rule:

OptionShould you pick it?
x64Yes. Almost every modern Windows PC is 64-bit.
Non Thread SafeYes, this is the right choice for this guide. It is what you want for the command line and PHP’s built-in server.
Thread SafeOnly if you plan to use Apache with mod_php. It is not wrong for beginners, just not needed here.
Debug Pack / Development packageNo. These are for people building PHP extensions.
windows.php.net/download● ● ●
PHP 8.5
VS17 x64 Thread SafeZip
VS17 x64 Non Thread Safe pick this oneZip Debug Pack
VS17 x86 Non Thread SafeZip

Example layout. Click the plain Zip link, not the Debug Pack.

Click Zip and let it download. It is around 33 MB.

Tip: The real page also shows a SHA256 code next to each file. You can compare it with your download to be sure the file is genuine. This is optional for beginners, but it is a good habit.

STEP 2

Extract PHP to C:\PHP

We will keep PHP in a short, simple folder: C:\PHP. A short path is easy to remember and avoids problems with spaces in folder names.

1Open This PC → Local Disk (C:) and create a new folder named PHP.
2Right-click the downloaded ZIP and choose Extract All.
3Set the destination to C:\PHP and click Extract.

Open C:\PHP. You should see php.exe directly inside, not inside another folder.

PHP● ● ●
This PC › Local Disk (C:) › PHP
📁 ext
⚙️ php.exe this must be here
⚙️ php-cgi.exe
📄 php.ini-development
📄 php.ini-production

If you see a PHP folder inside your PHP folder, move the files up one level.

STEP 3

Create and Edit php.ini

PHP reads its settings from a file called php.ini. The download comes with two templates but no real php.ini, so we make one.

1Copy php.ini-development (it is the right one for learning).
2Paste it in the same folder, then rename the copy to php.ini.
3Open it with Notepad or VS Code.

Can’t see “.ini” in the name? In File Explorer, click View → Show → File name extensions. Otherwise you may accidentally create php.ini.txt, which PHP will ignore.

In php.ini, a line that starts with a semicolon ; is switched off. Removing the semicolon switches it on. Use Ctrl + F to find these lines and remove the semicolon in front of each:

C:\PHP\php.ini
; BEFORE (switched off)
;extension_dir = "ext"
;extension=curl
;extension=fileinfo
;extension=mbstring
;extension=openssl

; AFTER (switched on)
extension_dir = "ext"
extension=curl
extension=fileinfo
extension=mbstring
extension=openssl

Only delete the semicolon. Leave everything else on the line exactly as it is.

What do these do? extension_dir tells PHP where its add-ons live. curl lets PHP talk to other websites and APIs, mbstring handles text in any language, openssl enables secure connections, and fileinfo detects file types. Most projects and Composer need them.

Save the file with Ctrl + S.

STEP 4

Add PHP to the Windows PATH

This is the most important step. PATH is a list of folders Windows checks when you type a command. Adding C:\PHP to it means you can type php from any folder.

1Press the Start key and type environment variables.
2Click Edit the system environment variables.
3Click Environment Variables… at the bottom.
4Under System variables, select Path and click Edit.
5Click New, type C:\PHP, then press Enter.
6Click OK on every window to save.
Edit environment variable✕
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Program Files\Git\cmd
C:\PHP new
OKCancel

Your list will have different entries. Just add C:\PHP at the end and do not delete anything.

Careful: Do not delete or change the existing lines in Path. Only add a new one. Also, make sure you type C:\PHP with no spaces and no extra characters at the end.

STEP 5

Test PHP 8.5

Now close every Command Prompt or PowerShell window and open a brand-new one. This matters: windows that were already open do not know about the new PATH.

Type this and press Enter:

Command Prompt
php -v

If it worked, you will see something like this:

Command Prompt
C:\Users\You> php -v
PHP 8.5.x (cli) (built: ...) ( NTS Visual C++ 2022 x64 )
Copyright (c) The PHP Group
Zend Engine v4.5.x, Copyright (c) Zend Technologies

Your exact version numbers may differ slightly. Seeing “PHP 8.5” means success.

Want to double check that your php.ini is being used and your extensions loaded? Run these two commands:

Command Prompt
php --ini
php -m

php --ini should show C:\PHP\php.ini as the loaded file, and php -m lists the active extensions, including curl, mbstring, openssl and fileinfo.

Run Your First PHP Script

Create a folder called php-projects, then create a file inside it named test.php with this code:

test.php
<?php
echo "PHP 8.5 is working on Windows!";

Open Command Prompt inside that folder and run it:

Command Prompt
php test.php
Output
C:\php-projects> php test.php
PHP 8.5 is working on Windows!

You did it! PHP 8.5 is installed and running on your computer.

Bonus: See PHP in Your Browser

You do not need Apache or XAMPP to start. PHP has a small web server built in. Run this inside your php-projects folder:

Command Prompt
php -S localhost:8000

Then open http://localhost:8000/test.php in your browser. You will see your message on the page. Press Ctrl + C in the terminal to stop the server.

Troubleshooting: If Something Goes Wrong

ProblemHow to fix it
“php is not recognized”Open a new Command Prompt. If it still fails, re-check that C:\PHP is in the System Path and that php.exe is directly inside it.
VCRUNTIME140.dll was not foundInstall the Microsoft Visual C++ Redistributable 2015-2022 (x64), then try again.
“Unable to load dynamic library”Check that extension_dir = "ext" has no semicolon, and that you only removed the semicolon on real extension lines.
php –ini shows “Loaded Configuration File: (none)”Your file may be named php.ini.txt. Show file extensions and rename it to php.ini.
Windows blocks the filesRight-click the ZIP, choose Properties, tick Unblock, then extract again.

Common Questions

Should I use Thread Safe or Non Thread Safe?

For the command line and PHP’s built-in server, use Non Thread Safe. Choose Thread Safe only if you plan to run PHP as an Apache module. Both work for learning, but Non Thread Safe is the simpler default.

Do I need XAMPP or Laragon instead?

No. XAMPP and Laragon install PHP, Apache and MySQL together in one click, which is handy later. Installing PHP by hand, like in this guide, teaches you how it actually works and gives you a clean setup.

How do I update PHP later?

Download the new ZIP, extract it over a fresh folder, copy your php.ini across, and keep the same PATH entry. Always keep your old folder until the new one works.

Can I use development settings on a live website?

No. php.ini-development shows errors on screen, which is great for learning but unsafe on a live site. For production, start from php.ini-production.

Final Thoughts

That’s it. You downloaded PHP 8.5, extracted it to C:\PHP, set up php.ini, added it to your PATH, and ran your first script. Every PHP developer on Windows starts with these exact steps.

Next up: connecting a local web server like Apache and building real pages. Subscribe so you don’t miss it, and tell me in the comments if you got stuck anywhere. I will help you.

Watch the Full Video Tutorial

Prefer to follow along on screen? I walk through every step in the video below, so you can pause and copy exactly what I do.

▶ Watch on YouTube   Subscribe to the Channel

If this guide helped you, share it with a friend who is starting PHP. Thank you for reading!

Share this article

Muhammad Azeem

Written by

Muhammad Azeem

Articles by Muhammad Azeem on azeemtechstudio.com.

Stay Updated

Get the latest coding tutorials, web development tips, AI tools, and technology articles delivered to your inbox.

No spam — we only use your email to send new articles.

Join the Discussion

Your email address will not be published. Required fields are marked *

About AzeemTechStudio

AzeemTechStudio Learn about programming and Web Development

Practical tutorials, programming tips and insights on Laravel, PHP, Docker, Linux, JavaScript, AI and modern web development.

Learn more