Sections:

Configuring Apache 2.4 to use PHP 8.1

  1. Click the Search Icon. Type Command Prompt
  2. Click on the Command Prompt program.
  3. Run notepad C:\Apache24\conf\httpd.conf
  4. In nodepad, search for mod_rewrite. Be sure to search down.
  5. Change

    #LoadModule rewrite_module modules/mod_rewrite.so

    to

    LoadModule rewrite_module modules/mod_rewrite.so
  6. Browse to https://www.php.net/manual/en/install.windows.apache2.php. Scroll to the Installing as an Apache handler section. This is where the configuration lines in the next step comes from.
  7. Add the following below the LoadModule lines

    LoadModule php_module "c:/php/php8apache2_4.dll"

    SetHandler application/x-httpd-php

    PHPIniDir "C:/php"
  8. Search for DirectoryIndex index.html. Change this line to DirectoryIndex index.html index.php
  9. Save the file. Exit notepad.
  10. Restart Apache 2.4. To do this run the `services.msc` command. Locate Apache 2.4 in the list. Right click on it and choose Restart.