How to Install PHP in Windows Server 2022

How to Install PHP in Windows Server 2022

One of the best things on Windows Server 2022 is the Web Platform Installer (WPI), using which you can install PHP with Internet Information Services (IIS). However there are other methods to install PHP on your Windows Server 2022 but in this article we’ll be using WPI to do so as it takes considerably less time than its alternatives.

In this article we’ll guide you through the process of installing PHP on your system using IIS.

  1. In your Windows Server 2022, open the Control Panel.
  2. Under Programs and Features you’ll find Turn Windows Features on or off, click on it.
    A pop up window will open up.
    screenshot of Program folder with highlighted Programs and Features tool
  1. The Add roles and features wizard will be launched with the “Before you begin” page.
    Check the “Skip this page by default” option to skip it in the future.
    Proceed by hitting “Next”.
  2. Choose the “Role-based or feature-based installation” radio button since running a PHP code
    on your Windows 2022 server in a role-based type of installation.
  3. You will see in the picture below that IIS has already been installed in our system.
    However, in your case, you need to select the CGI Server in the Roles services.
  4. Click on Web Server (IIS) and then  Web Server and then Application development.
    Check the box next to CGI, if it isn’t already.
    screenshot of Add Roles and Features Wizard (selecting a GCI role)
  1. Click “Next”, in Features.
  2. In the Confirmation window, click Install button to install CGI in IIS.

    screenshot of Installation process
  1. Now, download the WebPI using this link and then install it, depending on your system bit. of Web Platform Installer Direct Downloads page with highlighted the WebPI versions
  1. Now Install the WebPlatformInstaller_x64_en-US.msi, we just Downloaded.
  2. After installation, you can see the Microsoft Web Platform Installer in the start menu. Open it.
  3. The Web Platform Installer window will open up.
    Go to the Products section and search for php

    screenshot of Web Platform Installer (searching and selecting a PHP version)
  1. Find PHP 8.0.0 (x64), or anything above it, and then click on the Add button next to it.
    And then click on the Install button and agree with the terms to install PHP.
    screenshot of installation process

However, you’ll have to keep in mind that this may lead to the installation of components without you choosing them. And you might all see a failed installation message for PHP Manager for IIS but you can still use the text editor and the command line to make changes in configuration.

You can also test the PHP installation. Use the following code to make a test file:

<?php phpinfo(); ?>

I have created a file called phpinfo.php to test the PHP.

Now open your browser and run this file through it. For example, http://localhost/phpinfo.php or your serverip/phpinfo.php.

You should see something like this if the installation was successful:

screenshot of php version

And that’s all. You’ve successfully installed PHP in your Windows Server 2022. Now you can go ahead and use to install applications. And why just install existing applications, you can also create your own PHP applications, the sky’s the limit! :-)

How To Set up a VSFTPD Server on a CentOS 7 VPS or Dedicated Server

Brief Description FTP is usually insecure exposing clear-text passwords, userna
2 min read
Avi Ilinsky
Avi Ilinsky
Hosting Expert

How To Set up a VSFTPD Server on an Ubuntu 16.04 VPS or Dedicated Server

Brief Description FTP data is usually insecure since information (usernames, pa
2 min read
Eliran Ouzan
Eliran Ouzan
Web Designer & Hosting Expert

How to use phpMyAdmin to develop a website (without MySQL experience)

Brief description A web developer who is not well versed into coding websites f
2 min read
Idan Cohen
Idan Cohen
Marketing Expert

How to Install MySQL on a Windows Web Server Running Apache

This tutorial will show you how to install the MySQL database on a Windows serve
3 min read
Michael Levanduski
Michael Levanduski
Expert Hosting Writer & Tester provides professional web hosting reviews fully independent of any other entity. Our reviews are unbiased, honest, and apply the same evaluation standards to all those reviewed. While monetary compensation is received from a few of the companies listed on this site, compensation of services and products have no influence on the direction or conclusions of our reviews. Nor does the compensation influence our rankings for certain host companies. This compensation covers account purchasing costs, testing costs and royalties paid to reviewers.
Click to go to the top of the page
Go To Top