Skip to content

The Dummy Programmer

Stories of daily programming

  • Home
  • The Dummy Programmer Robot
    • Overview
    • Version history & downloads
    • Tutorials
      • TDP Robot – The basics
      • A simple SQL Server backup solution
      • A simple SQL Server backup solution – A next step
  • My other dummy projects
  • Games
    • Space Y: An Asteroids clone
  • Services
    • What’s my user agent
    • What’s my IP address
  • Donate
  • About
  • Toggle search form

Configure a PHP development environment in Windows (part 1 of 4)

Posted on August 25, 2020September 5, 2020 By

As everyone knows, PHP is one of the most used server side languages on the web, and Windows is the dominating operating system for desktop PCs. So I think that a quick summary on how to configure a PHP development environment in Windows could be useful. In this post we will use the last version of Windows: Windows 10.

IIS installation

By default, IIS (Internet Information Services, that is Microsoft’s web server software) is not installed. So the first step is to install it.

To do that, open the Window’s control panel and click on “Programs and feature”:

Windows Control Panel

You will see the list of the currently installed programs on your PC. Click on “Turn Windows features on or off”.

Programs and Features

A new window will appear with a list of Windows features that you can select. You can see in the red box the elements I have selected for the installation. To use PHP is important that you select “CGI”.

Windows Features

Now press “OK” to proceed with the installation.

PHP installation

To install the PHP runtime you could refer to this link from Microsoft:

https://docs.microsoft.com/en-us/iis/application-frameworks/scenario-build-a-php-website-on-iis/configuring-step-1-install-iis-and-php

In any case here are the necessary steps and some screenshot that should help for your installation.

First of all, download the zip containing the PHP runtime. You can download at this URL:

https://windows.php.net/download/

Below is an excerpt from the web page. In this moment, the latest version of PHP is 7.4.9, so we will download that version. Note that you have to choose the “Non Thread Safe” version. Click on the “Zip” link to download.

PHP runtime download

When the download is completed, extract the zip in the folder “C:\php_7_4_9” (or whatever folder you prefer). Remember to rename the file “php.ini-development” in “php.ini”.

Now we have to put the folder we just created in the “PATH” environment variable. To do that, follow these steps:

Open Windows control panel again, and this time click on “System”:

Windows control panel (again...)

You will see the following window, where you have to click on “Advanced system setting”.

Windows System

The “System properties” window will appear:

Windows System Properties

Now click on the button “Environment variables…” to show the following window:

Environment Variables

In the frame “System variables” select the row containing the variable “Path” and click “Edit”. In the following window, click “New” to add a new item with the path of the php runtime. As you can see below, I have already added my path.

Edit environment variables

Now that you configured the environment “PATH” variable, there is one more step: IIS configuration. To complete this step, run IIS Manager. When IIS Manager is running, click on your host name (the red box on the left) and then click on “Handler Mappings” (the red box on the right).

IIS Manager

And here is the “Handler Mappings” window. Click on “Add Module Mapping…” on the right.

IIS Handler Mappings

In the following window fill the fields as in the screenshot. Pay attention that you may have a different php runtime path. In my case is “C:\php_7_4_9”. Click “OK” to confirm.

Add Mapping...

We are almost done… At this point I always prefer to restart IIS. From Windows control panel, click on “Administrative tools” and then “Services”.

Go to Windows Services

In the list of services, look for “World Wide Web Publishing Service”, click it to select the row and from the context menu click on “Restart”.

Restart World Wide Web Publishing Service

Now you are ready to create your first php script. With Notepad create a new text file called “test.php” with the following content:

<?php
phpInfo();

Put this file in IIS default website folder which, in my case, is “C:\inetpub\wwwroot”.

Run a browser and go to the url “http://localhost/test.php”. You should see the following:

Your first PHP script!

Congratulations, you are running PHP on your Windows PC!

PHP, Web programming, Windows, Windows 10

Post navigation

Previous Post: Kernel headers not found for target kernel
Next Post: Configure a PHP development environment in Windows (part 2 of 4)

Related Posts

Is Environment.TickCount reliable? C#
Create a folder starting with dot in Windows Windows
HTML AJAX image upload & preview with JQuery and PHP AJAX
Splitting a big file in multiple small files Windows
Encrypt a Windows drive with Bitlocker Bitlocker
Windows 10 search no more working!! Windows 10

Search

Subscribe to our newsletter

Related posts

  • Configure a PHP development environment in Windows (part 2…
  • Configure a PHP development environment in Windows (part 4…
  • Configure a PHP development environment in Windows (part 3…
  • Is Environment.TickCount reliable?

Categories

  • .NET 6 (1)
  • AJAX (1)
  • Android (2)
  • Apache (4)
  • ASP.NET (9)
  • ASP.NET MVC (3)
  • Avalonia UI (1)
  • BCP (1)
  • Bitlocker (2)
  • C# (14)
  • CentOS (4)
  • ClosedXML (1)
  • CLR (1)
  • DNS (1)
  • Encryption (3)
  • Excel (2)
  • FuelPHP (3)
  • Google Chrome (1)
  • GSuite (1)
  • HTML (1)
  • Imagick (2)
  • Javascript (1)
  • Kindle (1)
  • LAMP (3)
  • Linux (6)
  • MariaDB (2)
  • Mathematics (2)
  • MySql (4)
  • NPOI (1)
  • Office 365 (1)
  • Perl (1)
  • PHP (6)
  • Programming (1)
  • Remote desktop (1)
  • SFTP (2)
  • Sockets (3)
  • Sql Server (18)
  • Sql Server 2016 (14)
  • Sql Server 2019 (1)
  • SSL (2)
  • Task scheduler (1)
  • Telerik ASP.NET AJAX (2)
  • The Dummy Programmer Chat (2)
  • The Dummy Programmer Robot (6)
  • Threading (5)
  • Tools (1)
  • TPL (3)
  • TypeScript (3)
  • Ubuntu (4)
  • Virtualization software (3)
  • Visual Studio (1)
  • Visual Studio Code (2)
  • Web fonts (1)
  • Web programming (6)
  • Windows (12)
  • Windows 10 (15)
  • Windows Forms (1)
  • Windows Server (5)

Copyright © 2022 The Dummy Programmer | Privacy Policy |

Powered by PressBook Masonry Dark