How to Install PHP in Windows 10

Last updated on November 9th, 2026 at 02:14 pm

To install PHP in Windows 10, download the VS17 x64 Non Thread Safe ZIP of the latest PHP release from the official PHP for Windows downloads page, extract it to C:\php, add C:\php to your Path, and copy php.ini-development to php.ini. Then open a new Command Prompt and run php -v. If you see a version number, PHP is installed.

PHP for Windows has no setup wizard. It’s a folder of files you unzip and point Windows at, which sounds odd at first but makes it easy to update or remove later.

Applies to: 64-bit Windows 10 (and Windows 11), PHP 8.5 and 8.4. PHP itself still runs on Windows 10, because the current releases require Windows 8 or later.

Which PHP download should you pick?

The download page lists several versions and four builds of each. Two choices matter.

Version. According to PHP’s supported versions page, PHP 8.5 and 8.4 get full bug fixes, while 8.3 and 8.2 get security fixes only (8.2 stops on December 31, 2026). Pick the newest version unless a project or web host needs a specific one. If your live site runs PHP 8.4, for example, install 8.4 locally so you test the same thing.

Build. Each version comes as x64 or x86, and Thread Safe (TS) or Non Thread Safe (NTS):

You want toDownload
Run PHP scripts in Command Prompt, use Composer, or use the built-in test serverx64 Non Thread Safe
Run PHP through IIS with FastCGIx64 Non Thread Safe
Load PHP as a module inside Apachex64 Thread Safe

The PHP manual’s Windows installation page recommends NTS for command-line scripts and IIS, and TS for Apache with mod_php. Use x86 only on a 32-bit copy of Windows. To check yours, open Settings > System > About and look at System type. PHP doesn’t run on Windows on ARM.

Visual C++, admin rights and extensions

  • Install the Visual C++ Redistributable. PHP’s Windows builds need Microsoft’s Visual C++ runtime. Many PCs already have it from other apps. If not, download the x64 version from Microsoft’s latest supported Visual C++ Redistributable page. It covers programs built with Visual Studio 2017 through 2026, which includes the VS17 builds of PHP. If it’s already installed, the installer says so and changes nothing.
  • Use an administrator account. You need one to create a folder at the root of C: and to edit the system Path.
  • Turn on file extensions. You’ll be renaming php.ini-development to php.ini, and hidden extensions make that easy to get wrong. Here’s how to show file extensions in Windows 10.

Install PHP from the ZIP file

  1. Go to windows.php.net/download. Find the section for the version you chose, such as PHP 8.5.
  2. Under VS17 x64 Non Thread Safe, click Zip. (Choose VS17 x64 Thread Safe instead if you’re pairing PHP with Apache.) The file name looks like php-8.5.x-nts-Win32-vs17-x64.zip.
PHP for Windows downloads page with the VS17 x64 Non Thread Safe Zip link highlighted under PHP 8.5
The current Windows download address redirects to PHP’s Downloads & Installation Instructions page. Under PHP 8.5, choose Zip in VS17 x64 Non Thread Safe for command-line PHP or IIS. This focused recreation omits the sidebar and the extra hashes beneath Debug Pack and SDK.
  1. Open File Explorer and create a folder named php directly on the C: drive, so the path is C:\php. A short path with no spaces avoids trouble with tools that call PHP.
  2. Open your Downloads folder, right-click the ZIP, and choose Extract All. Click Browse, pick C:\php, and click Extract.
  3. Open C:\php and check the layout. You should see php.exe, php-cgi.exe, an ext folder and two files named php.ini-development and php.ini-production. If you see a single folder instead, the files are one level too deep: move its contents up into C:\php.

Do I need to restart Windows after adding PHP to Path?

Usually not. New Command Prompt windows pick up the change right away. Some apps that were already running, such as code editors, need to be closed and reopened before they can find PHP.

Add C:\php to your Path

The Path variable tells Windows where to look when you type a command. Adding C:\php lets you type php in any folder.

  1. Click Start, type environment, and select Edit the system environment variables. The System Properties window opens on the Advanced tab.
  2. Click Environment Variables.
  3. In the lower box, System variables, select Path and click Edit. (Use the upper box, User variables, if you only want PHP for your own account.)
  4. Click New, type C:\php, and press Enter. Don’t change or delete the other entries; apps rely on them.
Windows 10 Edit environment variable dialog with C:\php added as a new entry in the system Path
Add the PHP folder as a new Path entry and keep the existing system folders. The selected last entry is the example PHP folder; no real environment variable was changed.
  1. Click OK in all three windows.

The PHP manual warns not to overwrite Path, only to add to it, and the steps above do exactly that. For more on user versus system variables and command-line options like setx, see setting environment variables in Windows 10.

Check that PHP works

Command Prompt windows that were already open still use the old Path, so start fresh. Close any open ones, then open Command Prompt again and run:

php -v

You should see a line starting with PHP 8.5 (or the version you chose), followed by the build date and a label such as NTS Visual C++ 2022 x64. ZTS in that label means you have the Thread Safe build.

Recreated Windows Command Prompt showing PHP 8.5.12 NTS Visual C++ 2022 x64 and the loaded PHP configuration file
In a newly opened Command Prompt, php -v identifies the 64-bit NTS build and php --ini confirms the example PHP configuration file is loaded. Build-time and copyright details are obscured in this focused recreation.

For a one-line test, run php -r "echo 'Hello, Alex';". PHP should print Hello, Alex.

Create and edit php.ini

PHP runs without a php.ini file, but every extension stays off and it falls back to default settings. Create one now.

  1. In C:\php, copy php.ini-development and paste it in the same folder. Rename the copy to php.ini. (On a machine that serves real visitors, start from php.ini-production instead, which hides error details from the public.)
  2. Right-click php.ini and open it with Notepad. Press Ctrl + F to find each setting below. A semicolon at the start of a line turns it off, so deleting the semicolon turns it on.
  3. Find ;extension_dir = "ext" (the one under “On windows”) and delete the semicolon.
  4. Remove the semicolon from the extensions you need. Common ones are extension=curl, extension=fileinfo, extension=mbstring, extension=openssl, extension=pdo_mysql, extension=mysqli and extension=zip. WordPress, Laravel and Composer all expect several of these.
  5. Find ;date.timezone =, delete the semicolon, and add your zone, for example date.timezone = America/Chicago.
  6. Save the file. Make sure Notepad didn’t save it as php.ini.txt.

Run php --ini. The Loaded Configuration File line should read C:\php\php.ini. Then run php -m to list the extensions that loaded.

Try PHP in a browser

PHP includes a small web server for testing, so you don’t need Apache or IIS just to see a page.

  1. Create a folder such as C:\sites\test.
  2. In Notepad, type <?php phpinfo(); and save it in that folder as index.php (set Save as type to All files).
  3. In Command Prompt, run cd C:\sites\test, then php -S localhost:8000.
  4. Open http://localhost:8000 in your browser. A long purple-and-gray table of PHP settings means everything works.
  5. Press Ctrl + C in Command Prompt to stop the server.

The built-in server is meant for development only; the PHP manual says it should not be used on a public network.

Another way: install PHP with winget

If you prefer a single command, the Windows Package Manager can download PHP and add it to Path for you. Microsoft documents winget for Windows 10 version 1809 and later, as part of the App Installer from the Microsoft Store.

  1. Open Command Prompt or PowerShell and run winget search PHP.PHP to see the PHP packages on offer.
  2. Install the version you want, for example winget install PHP.PHP.8.5.
  3. Close the window, open a new one, and run php -v.

A few things to know before you choose this route. The PHP packages in winget come from the community package repository, not from the PHP project’s own download page. The build you get may be Thread Safe, so check the php -v label if you need NTS. Winget doesn’t create php.ini for you; run php --ini to see which folder PHP reads it from and copy php.ini-development there. If you want full control over the folder and build, the ZIP method above is simpler to reason about.

Connect PHP to Apache or IIS

For a setup closer to a real host, run PHP behind a full web server.

  • Apache: use the Thread Safe build. After you install Apache in Windows 10, add these lines to the end of httpd.conf, then restart Apache. They follow the PHP manual’s Apache 2.x instructions:
    LoadModule php_module "C:/php/php8apache2_4.dll"
    <FilesMatch \.php$>
        SetHandler application/x-httpd-php
    </FilesMatch>
    PHPIniDir "C:/php"
    Note the forward slashes; Apache expects them in paths.
  • IIS: use the Non Thread Safe build. When you enable IIS in Windows 10, also check CGI under Application Development Features. Then, in IIS Manager, add a FastCGI handler mapping for *.php that points to C:\php\php-cgi.exe (not php.exe), as described in the PHP manual’s IIS page.

If you’d rather not configure each piece, an all-in-one package such as XAMPP installs Apache, MariaDB and its own copy of PHP together. That’s the route used to install WordPress in Windows 10. Just don’t leave both C:\php and XAMPP’s PHP folder in your Path, or you’ll get whichever one comes first.

Add Composer (optional)

Most modern PHP projects install their libraries with Composer. With PHP on your Path and extension=openssl turned on, download and run Composer-Setup.exe, which the Composer documentation says installs the latest version and sets up your Path. If the installer asks where PHP is, point it to C:\php\php.exe. Afterward, close your terminal, open a new one, and run composer --version.

Fixing common problems

  • “‘php’ is not recognized as an internal or external command.” The window was open before you changed Path, or the entry is wrong. Close every Command Prompt and PowerShell window and try again. If it still fails, reopen the Path editor and make sure the entry reads exactly C:\php and that php.exe is directly inside that folder. Signing out and back in also refreshes Path.
  • “VCRUNTIME140.dll was not found” or a similar DLL error. The Visual C++ Redistributable is missing or doesn’t match. Install the x64 package for x64 PHP (or the x86 package for x86 PHP).
  • Extensions don’t load, or Composer reports a missing ext-openssl or ext-mbstring. Run php --ini. If Loaded Configuration File says (none), php.ini isn’t in C:\php or is named php.ini.txt. If it loads, check that extension_dir is uncommented and the extension line has no semicolon.
  • php -v shows a different version than you installed. Another PHP folder, often from XAMPP or an older install, is listed above C:\php in Path. Run where php to see every copy Windows finds, then remove or move down the one you don’t want.
  • Port 8000 is already in use. Start the test server on another port, such as php -S localhost:8080.
  • The browser downloads index.php instead of running it. The web server isn’t passing .php files to PHP. Recheck the Apache lines or the IIS handler mapping above.

Can I run PHP without a web server?

Yes. Run a script directly with php myscript.php, which is handy for automation tasks, or use the built-in test server shown above to view pages in a browser.

Update, switch versions or remove PHP

To update to a newer release, extract the new ZIP to a fresh folder (for example C:\php-new), copy your php.ini across and compare it with the new php.ini-development for changes, then rename the folders so the new one becomes C:\php. Keeping the old folder for a while gives you an easy way back. With winget, run winget upgrade PHP.PHP.8.5 to get the latest 8.5 release.

To remove PHP, delete the C:\php folder and delete the C:\php entry from Path in the same Environment Variables window. For a winget install, run winget uninstall PHP.PHP.8.5.

Can I have two PHP versions installed?

Yes. Extract each to its own folder, such as C:\php84 and C:\php85. Only the one listed first in Path answers to php; run the other by its full path, for example C:\php84\php.exe -v.

Once php -v works and php.ini is loaded, point the built-in server at a real project folder, or add Composer and start a framework project. The PHP manual’s Windows installation section covers the less common setups, such as building PHP from source.