Skip to content

The Dummy Programmer

Stories of daily programming

  • Home
  • My other dummy projects
  • Games
    • Space Y: An Asteroids clone
  • Services
    • What’s my user agent
    • What’s my IP address
  • 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

Create a folder starting with dot in Windows Windows
Encrypt a Windows drive with Bitlocker Bitlocker
Splitting a big file in multiple small files Windows
Configure a PHP development environment in Windows (part 3 of 4) PHP
Dell Inspiron 15 7000 – No Networks Found Windows
How to install Oracle VirtualBox in a Windows PC Virtualization software

Search

Related posts

  • Configure a PHP development environment in Windows…
  • Configure a PHP development environment in Windows…
  • Configure a PHP development environment in Windows…
  • Is Environment.TickCount reliable?

Categories

  • .NET 6 (1)
  • .NET 7 (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)
  • Games (2)
  • Google Chrome (1)
  • GSuite (1)
  • HTML (1)
  • Imagick (2)
  • Javascript (1)
  • Kindle (1)
  • LAMP (3)
  • Linux (7)
  • 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 (20)
  • Sql Server 2016 (14)
  • Sql Server 2019 (1)
  • SSL (4)
  • Task scheduler (1)
  • Telerik ASP.NET AJAX (2)
  • The Dummy Programmer Chat (2)
  • Threading (5)
  • Tools (1)
  • TPL (3)
  • TypeScript (3)
  • Ubuntu (4)
  • Virtualization software (3)
  • Visual Studio (1)
  • Visual Studio Code (2)
  • VueJS (1)
  • Web fonts (1)
  • Web programming (6)
  • Windows (12)
  • Windows 10 (15)
  • Windows Forms (1)
  • Windows Server (6)

Copyright © 2024 The Dummy Programmer | Privacy Policy | Terms of use |

Powered by PressBook Masonry Dark

Manage Cookie Consent
This site doesn’t collect user personal data and doesn’t install profiling or analytical cookies, either its own or from third parties. Read our privacy policy for more info.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
View preferences
{title} {title} {title}