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.
- In your Windows Server 2022, open the Control Panel.
- Under Programs and Features you’ll find Turn Windows Features on or off, click on it.A pop up window will open up.
- 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”.
- Choose the “Role-based or feature-based installation” radio button since running a PHP codeon your Windows 2022 server in a role-based type of installation.
- 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.
- Click on Web Server (IIS) and then Web Server and then Application development.Check the box next to CGI, if it isn’t already.
- Click “Next”, in Features.
- In the Confirmation window, click Install button to install CGI in IIS.
- Now, download the WebPI using this link and then install it, depending on your system bit.
- Now Install the WebPlatformInstaller_x64_en-US.msi, we just Downloaded.
- After installation, you can see the Microsoft Web Platform Installer in the start menu. Open it.
- The Web Platform Installer window will open up. Go to the Products section and search for php
- 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.
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:
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! :-)
- Looking for the best windows hosting? Click this link and check all our recommendations.