Sections:
Configuring Apache 2.4 to use PHP 8.1
- Click the Search Icon. Type Command Prompt
- Click on the Command Prompt program.
- Run
notepad C:\Apache24\conf\httpd.conf
- In nodepad, search for mod_rewrite. Be sure to search down.
- Change
#LoadModule rewrite_module modules/mod_rewrite.so
to
LoadModule rewrite_module modules/mod_rewrite.so
- 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.
- Add the following below the LoadModule lines
LoadModule php_module "c:/php/php8apache2_4.dll"
SetHandler application/x-httpd-php
PHPIniDir "C:/php"
- Search for
DirectoryIndex index.html
. Change this line to DirectoryIndex index.html index.php
- Save the file. Exit notepad.
- 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.