
In this tutorial, you will learn about how you can setup Apache, PHP and MySQL server on Windows 10.
If you are planning to install Apache, MySQL and PHP on Windows 10, you have two options:
- you can download and install a free web development environment (WampServer, XAMPP)
- you can create your own environment by installing Apache, PHP and MySQL manually
For beginners I recommend the first option. For the second option you have to decide as to which version of each application will be installed. In this tutorial I am going to setup
- Apache 2.4.46
- PHP 7.4 (7.4.13RC1)
- MySQL 5.7.31
Download the installation packages:
Apache: https://www.apachelounge.com/download/
PHP (download the Thread Safe version): https://windows.php.net/qa/
MySQL: https://downloads.mysql.com/archives/installer/
Apache 2.4 setup on Windows 10
- Unzip the downloaded files to the C:\Apache24 directory if possible (this is the default ServerRoot directory in the Apache configuration file)
- You can unzip to another location, but remember the path, you will have to change the SRVROOT variable in the http.conf file later
- Install the Visual C++ Redistributable for Visual Studio 2015-2019 x64
- After unzipping and installing the Visual C++ Redistributable package go to the C:\Apache24\conf directory and open httpd.conf in any text editor
- If you unzipped the files to other location as C:\Apache24, change the path to your location in the line below:
Define SRVROOT "c:/Apache24"
- Add a line right after #ServerName www.example.com:80 like this:
#ServerName www.example.com:80
ServerName localhost
- You are ready to go. I recommend to change the following lines too:
- Change AllowOverride None to AllowOverride All to enable .htaccess files in your projects:
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# AllowOverride FileInfo AuthConfig Limit
#
AllowOverride None
- Check if you the mod_rewrite module is enabled. Find the line
#LoadModule rewrite_module modules/mod_rewrite.so
and remove the # from the beginning to enable the module:
LoadModule rewrite_module modules/mod_rewrite.so
- To serve index.php file automatically if a directory is requested append index.php to the DirectoryIndex variable
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
To test the installation, open up the command prompt, go to C:\Apache24\bin and run Apache by typing httpd.exe:

If there is no error, open up a browser of your choice and go to http://localhost where you will see this page:

To run Apache automatically on startup, register it as a service. Open the Command Prompt as administrator (right click -> Run as administrator) and type in these lines:

Check Apache service in Services and click Start the service:

PHP 7.4 installation on Windows 10
- Unzip the downloaded package to C:\php74
- Go to the C:\php74 directory
- Rename php.ini-development to php.ini
- Add PHP 7.4 to system environment variable in Command Prompt:
C:>setx path "%PATH%, C:\php74" /M
- Open the C:\Apache24\conf\httpd.conf apache configuration file again and add these lines to the end of the file:
PHPIniDir "C:/PHP74"
AddHandler application/x-httpd-php .php
LoadModule php7_module "C:/PHP74/php7apache2_4.dll"
- Restart Apache 2.4 service in Services, or open the Command prompt and type
C:\>httpd -k restart
- To test the installation, create a file named phpinfo.php in C:\Apache24\htdocs directory and copy these lines to the file:
<?php
phpinfo();
- Open a browser of your choice and open http://localhost/phpinfo.php

MySQL 5.7 installation on Windows 10
- Download the installer
- Run the installer
- In the first step pick server-only and hit Next

- Download and install Microsoft Visual C++ 2013 Redistributable Package if you don’t have it already
- After installing Microsoft Visual C++ 2013 Redistributable Package click Next again
- If you downloaded the smaller package, click Execute in the third step and wait while the download ends
- Click Next, the next step is Product Configuration
- In the Product Configuration window click Next and pick the Standalone MySQL Server option in the first step

- Click Next
- In the Type and Networking step you can leave everything as it is (Config Type: Development Computer, Port: 3306), click Next again
- Set your MySQL Root Password and go to the next step
- Leave everything as it is in the next two steps (Next, then execute)
- The installation is done, click Finish
- Open Services and verify that the service named MySQL57 is running

- If you are not comfortable with the command line, you can download and install MySQL Workbench, or install phpmyAdmin to manage your databases through a graphical user interface