This article is a succession of step by step that shows you how to install Apache on Windows.
This article was done with the following application version but the principe stays and should work with all version
The Apache project does not provide the Windows binary.
The download php page recommends to use apachelounge because they use their binaries to build the Apache SAPIs.
Download the last binary at apachelounge
Example:
httpd-2.4.46-win64-VS16.zip
C:\Apache24
On windows, from 7.4, the sqlite extension needs to get access to the libsqlite3.dll that is located into the php directory.
If you are running the service with the system path, you should add the php home directory in the system path.
cd C:\Apache24\bin
httpd -k install
httpd -k start
There is more options. See the documentation
To get access to the main server:
ServerName local
The rewrite module permits to have nice url and is generally used.
Uncomment the line
LoadModule rewrite_module modules/mod_rewrite.so
Add virtual host
ServerName serverName
# Virtual Host
Include conf/extra/httpd-vhosts.conf
Add php as module of Apache in the httpd.conf file
On Windows, to be able to load the intl extension (localization), you need also to add the ICU file. In the documentation, they said that you can also set them on the LD_LIBRARY_PATH.
LoadFile "C:\php-7.2.28-Win32-VC15-x64\icudt64.dll"
LoadFile "C:\php-7.2.28-Win32-VC15-x64\icuin64.dll"
LoadFile "C:\php-7.2.28-Win32-VC15-x64\icuio64.dll"
LoadFile "C:\php-7.2.28-Win32-VC15-x64\icuuc64.dll"
Then:
LoadModule php7_module "C:/php-7.2.28-Win32-VC15-x64/php7apache2_4.dll"
AddType application/x-httpd-php .php
# configure the path to php.ini
PHPIniDir "C:/php-7.2.28-Win32-VC15-x64"
<Directory "C:/php-7.2.28-Win32-VC15-x64/" >
AllowOverride None
Options None
Require all granted
</Directory>
If you want to boost your performance, FastCGI is the way to go. See this article that shows how to install it
If you get this error in the log:
php -m
LoadFile "C:\php-7.2.28-Win32-VC15-x64\icudt64.dll"
LoadFile "C:\php-7.2.28-Win32-VC15-x64\icuin64.dll"
LoadFile "C:\php-7.2.28-Win32-VC15-x64\icuio64.dll"
LoadFile "C:\php-7.2.28-Win32-VC15-x64\icuuc64.dll"
For whatever reason, Apache locates the extension directory from the working directory. In the php.ini, be sure to put the qualified path.
extension_dir = "c:\php-7.2.28-Win32-VC15-x64\ext"
Be sure to add your php home directory into the user/system path that runs Apache. See bug 78957