installphp.info


← Back to home page

Install PHP 8.1 on Server 2022

Warning! This version of PHP is outdated.

PHP 8.1 reached end of active support on 25 Nov 2023. As of today, PHP 8.1 is only receiving security related updates through 31 Dec 2025, at which point it will be considered end-of-life and receive no further updates. It's strongly recommended to upgrade to the latest version of PHP before then.

Installing PHP 8.1 on Server 2022

Prerequisites

  • Windows Server 2022 installed and updated
  • Administrator access to the server
  • Internet connection for downloading PHP
  • IIS (Internet Information Services) role installed

Installation

  1. Download PHP 8.1 for Windows from the official PHP website
  2. Extract the downloaded ZIP file to a folder (e.g., C:\PHP)
  3. Rename php.ini-production to php.ini
  4. Edit php.ini and uncomment necessary extensions
  5. Add PHP to the system PATH environment variable
  6. Install the necessary Visual C++ Redistributable packages
  7. Configure IIS to use PHP:
    • Open IIS Manager
    • Select the server in the left pane
    • Double-click "Handler Mappings"
    • Click "Add Module Mapping" in the right pane
    • Enter the following details:
      • Request path: *.php
      • Module: FastCgiModule
      • Executable: C:\PHP\php-cgi.exe
      • Name: PHP_via_FastCGI
    • Click "OK" and "Yes" to create a FastCGI application
  8. Restart IIS

Verification

  1. Create a file named phpinfo.php in the web root directory (usually C:\inetpub\wwwroot) with the following content:
    <?php phpinfo(); ?>
  2. Open a web browser and navigate to http://localhost/phpinfo.php
  3. If PHP is installed correctly, you should see the PHP information page
  4. Verify that the PHP version displayed is 8.1.x
  5. Check that the necessary extensions are enabled