Installing Apache, PHP and MariaDB on Windows manually


These are the steps I took to install my own (local) web development setup on Windows. I moved away from XAMPP or WAMP installation packages because I want to have a way to change software version of each components easier and registering them as a Windows services.

  • Downloaded the latest version of software: Apache, PHP and MariaDB. I didn’t had to install appropriate Visual Studio Redistributable for obvious reason of having them already present on my computer. When picking the right PHP version, choose Thread-Safe and same architecture as Apache.

  • Installed or extracted them to a custom location C:\WebDevTools.

  • Modified SRVROOT variable in apache’s conf/httpd.conf file to reflect different install path – C:\WebDevTools\Apache24.

  • Also in conf/httpd.conf after all LoadModule directives I added the following lines because I decided to use php 7.3 and extracted it in C:\WebDevTools\php73.

LoadModule php7_module "C:\WebDevTools\php73\php7apache2_4.dll"

<IfModule php7_module>
    AddHandler application/x-httpd-php .php
    AddType application/x-httpd-php .php .html
    PHPIniDir "C:\WebDevTools\php73"
</IfModule>
  • In php installation folder I copied php.ini-development to php.ini and in uncommented directive directory_ext="ext" and set its value to C:\WebDevTools\php73\ext. And because I will be accessing a database I also enabled appropriate extensions (mysqli, pdo_mysql) by uncommenting them.

  • Went to Apache24 bin directory, opened PowerShell as an Administrator and fired command .\httpd.exe -k install which installed Apache as a service.

  • Installed MariaDB with default options (without changing root passoword).

I used this guide for reference.

Then I installed another Apache server instance, this time with differnet PHP version. That way when in need of different PHP version, I only have to quit currently running Apache server and start another. Instead of editing http.conf everytime.