How to install WordPress, PHP, Apache & MySQL on Windows

Install WordPress - PHP - Apache - MySQL - phpMyAdmin

When developing for WordPress locally on Windows, we need to have Apache, PHP and MySQL installed. There are web development environments available such as EasyPHP or WampServer, but I always prefer to install them manually. The experience you gain from it becomes useful when you encounter a problem with either PHP, Apache, or MySQL database as you will have a better idea where to look for the issues.

We will first install a PHP, then an Apache web server, and finally a MySQL database. We will also install the MySQL Notifier utility to manage the MySQL instances and phpMyAdmin tool, to manage MySQL databases. Finally, we will go through each step to install WordPress that will run on our localhost.

So let's get started.

1. Install PHP

WordPress is written in PHP which is a scripting language and we are going to install that first. On PHP official download page, there will be two versions available for download, ThreadSafe and NonThreadSafe. We will download the ThreadSafe .zip file.

Extract the ThreadSafe file somewhere on your computer and copy the folder to C: root partition. Currently, the latest PHP version is 8.x, so we will rename the folder to php8 to reflect the PHP version. The absolute PHP path will be as follows:


About the php.ini configuration file

The php.ini is a default PHP configuration file where we declare changes to the PHP behavior. The extracted files inside C:\php8 will not have the php.ini file. Instead, you should see two configuration files, php.ini-development and php.ini-production. The main difference is that in the development version, the warnings and errors are not hidden, so we will use that one.

We will make some changes to it and then save it as php.ini file.

Modify the php.ini file

Open php.ini-development in the text editor so we can make the following modifications:

  • Extension directory

    ;extension_dir = "ext"

    Change it to this:

    extension_dir = "C:\php8\ext"

    We uncommented the line by removing semicolon ; at the beginning and added path to ext folder, which in our case is C:\php8\ext. This is the folder containing various PHP extension .dll libraries.

    By default, all these extensions are commented out, but we need to enable a few of them.

  • openssl extension
    Find the following line:


    Remove the comment by removing semicolon ; so that the line looks like this:


    We need openssl extension to be able to update WordPress plugins, otherwise, we get the "No working transports found" error discussed in this article.

  • mysqli extension
    We also need to enable mysqli extension for the MySQL library. Find this extension (it should be few lines above extension=openssl) and remove the comment so it will look like this:

  • Other extensions
    Some WordPress plugins also need other extensions to be enabled, such as curl and fileinfo extension, so you might also uncomment those, but for basic WordPress installation, mysqli and openssl extension is all we need.
  • Note: With cURL extension, just enabling it in php.ini might not be enough. Check this article to learn how to enable cURL in Windows.
  • upload_max_filesize and post_max_size directives
    Let's also modify few more lines. Find the following:

    upload_max_filesize = 2M

    and change it to

    upload_max_filesize = 64M

    Also find this line:

    post_max_size = 8M

    and change it to:

    post_max_size = 64M

    Increasing the value of upload_max_filesize and post_max_size directives will increase the allowed uploaded file and POST data in the PHP applications. We need this for example when importing a database using the phpMyAdmin tool. If the imported database file size is greater than the above specified-values, the import could fail with the message "phpMyAdmin - Error - Incorrect format parameter".

We are finished with modifying the configuration file. Don't forget to save the changes as php.ini file!!

Note: When making changes in php.ini file while the Apache server is running, we need to restart the Apache server for changes to take effect.

We are done configuring PHP, now let’s turn our focus to the Apache webserver.

2. Install Apache

Apache is a web server software that enables your computer to host websites. We can download Apache by going to Apache Lounge download page. Download the Win64 or Win32 .zip file, extract it and copy Apache24 folder into C:, so that the path is:


Configuring Apache

Now we need to configure Apache. Go to C:\Apache24\conf and open the httpd.conf in the text editor.

  • Listen directive
    Let’s first make sure the Apache will only listen to localhost. Find the following line. It should be at the start of the httpd.conf file:

    Listen 80

    Change it to:


    This will make sure that the Apache listens only to requests from localhost and will ignore the external addresses.

  • DocumentRoot and Directory directive
    Next, we need to set the root server folder in httpd.conf file.
    Find the following directives:

    DocumentRoot "${SRVROOT}/htdocs"
    <Directory "${SRVROOT}/htdocs">

    You can leave it as it is in which case the root server folder will be located at:


    If you prefer to have it somewhere else, change the path. For example, if you want it to be at d:/www, you would change it to

    DocumentRoot "d:/www"
    <Directory "d:/www"> 

    Note: The folder separator in the path should contain forward slashes / instead of Windows backslashes \
  • AllowOverride directive
    Inside the <Directory> directive we just mentioned, find the following line:

    AllowOverride None

    Change it to this:

    AllowOverride All

    This change is needed for WordPress due to .htaccess file that it uses. Without .htaccess, the WordPress permalinks will not work as discussed in this article.

  • DirectoryIndex directive
    Next, we need to set the index.php as default page. Find the following line inside httpd.conf:

    DirectoryIndex index.html

    Change it to:

    DirectoryIndex index.html index.php

    In the above code, the index.html will have priority if both index.html and index.php exist on the same folder.

  • LoadModule and PHPIniDir directive
    At this moment, Apache will not yet process the .php files. We still need to tell Apache, where the PHP is located. We do this by adding a PHP server module using the LoadModule directive. In httpd.conf, there is a big list of various LoadModule commands. First, find the and remove # to uncomment it:

    LoadModule rewrite_module modules/

    This module will be needed when running WordPress and using permalinks.

    Now we need to add a PHP module. Go to the end of the LoadModule list and add the following two lines at the end:

    LoadModule php_module "c:/php8/php8apache2_4.dll"
    PHPIniDir "c:/php8"

    The path in LoadModule points to the php8apache2_4.dll file that is located inside the c:/php8.

    Note: If the php8apache2_4.dll is missing inside the c:/php8, it’s possible you downloaded NonThreadSafe version of the PHP. Go back to Apache Lounge download page and download the ThreadSafe version.

    With the PHPIniDir directive, we can tell the Apache where the PHP folder is located. Apache will first try to look in default locations, such as c:/php, but we have PHP installed at c:/php8.

  • AddHandler directive
    Now we need to tell Apache which files should be processed by PHP. We do that by using AddHandler directive. Find the following line in httpd.conf:

    #AddHandler cgi-script .cgi

    This is just a comment, so leave it as it is. Below it, add the following line:

    AddHandler application/x-httpd-php .php
  • ServerName directive
    Find the following line:


    This is also just a comment. Below it, add the following line:


    Without the ServerName directive, the Apache server might give you the following warning:

    AH00558: httpd.exe: Could not reliably determine the server's fully qualified domain name

And we are done with modification of Apache configuration file. Save the httpd.conf file.

Start the Apache server

All that is left to do is to start the Apache server. Go to C:\Apache24\bin and run the httpd.exe file. A window with a command prompt should open and remain open.

Note: If the command prompt windows closes immediately after running httpd.exe then there is probably an error in the httpd.conf file. In this case open the command prompt (click search on Windows and type cmd), type cd c:\apache24\bin and once there, typehttpd.exe. Check the errors shown, fix them and try running httpd.exe again.

Test the Apache web server

Now, let's test if the Apache server is really running. Open browser and go to or http://localhost/. The browser should now show you the content of the folder that was set in DocumentRoot and Directory directives when we modified the httpd.conf file.

Let’s create a test php file to see if Apache does indeed support PHP. Open text editor, create a test.php file in the root server folder and add the following code:

<?php echo 'hello world' ?>

Save the file and go to to run it. You should see the white page with the "hello world" message.

Starting Apache server by running c:\Apache24\bin\httpd.exe is not very efficient though. A better way is to run it as a service.

Run Apache as a service

First, close the Command Prompt window running httpd.exe if it is still opened from the previous step.

Next, we need to run a command prompt as an administrator. There are many ways to do this, one quick way is to type "cmd" in the Windows Search:

run cmd as administator in Windows

Command Prompt should show up as the best match. On the right side, click on "Run as administrator". User Account Control Window should show up asking you to confirm this. After clicking "Yes", the command prompt window should show up.

Inside the command prompt, first type the line shown below, so that we will be inside the Apache bin folder:

cd c:\apache24\bin

Once we are inside it, type the following command:

httpd -k install

If everything was successful, you should get the following message:

Installing the 'Apache2.4' service
The 'Apache2.4' service is successfully installed.
Testing httpd.conf....
Errors reported here must be corrected before the service can be started.

This will add Apache as a service, but the service has not started yet.

Manage Apache service

The easiest way to control the Apache Service is by running ApacheMonitor.exe located in the same c:\apache24\bin folder.

After running this utility, you should see that the notification icon on the taskbar has been added for the ApacheMonitor utility. If you click on it, you can start the Apache service by going to Apache2.4 > Start. You can also Stop and Restart the Apache service the same way.

apachemonitor.exe notification icon on taskbar windows 10

After selecting Apache2.4 > Start, the ApacheMonitor notification icon should now display in the Notification area as a tiny green arrow and if you hover over it, it should say "Running All Apache Services".

Adding ApacheMonitor.exe to a Windows Startup

It would be better if we make the ApacheMonitor.exe start with windows. Here are the steps:

  • Go to c:\apache24\bin and create a shortcut for ApacheMonitor.exe.
  • Type "run" in Windows Search and open the "Run" App.
  • "The popup window will show up. Type the command "shell:startup" as shown below and press enter:
    Run App message box - shell:startup
  • This will open the File Explorer in the "Startup" folder.
  • Copy the shortcut we created earlier to this folder.

Now, every time your Windows start, the ApacheMonitor.exe should also start.

So far we have a Web server that is able to process PHP files. Next, let’s install the MySQL database.

3. Install MySQL database

WordPress also uses MySQL database, so we are going to install the MySQL Community database on our Windows machine.

Downloading the MySQL

Go to MySQL download page. There should be two installers available for downloads. One is a much smaller web online installer which is handy if you have a slow internet connection as it will download only stuff you need. The other one is an offline installer with all the features and due to that is a much larger file. Choose whichever you prefer and click "download".

You should now see the following page.

MySQL Community Downloads Page

Simply click on the "No thanks, just start my download." link.

Run the MySQL Installer

After the download is complete, run the installer. User Account Control Window should show up. Check that the verified publisher is "Oracle America, Inc." and click "Yes". MySQL Installer window should open. The installer consists of the following steps as shown below:

Windows MySQL Installation Step - Choosing a setup type

  • Choosing a Setup Type
    In the first step, we need to choose a setup type. If you choose "Developer Default", it will install MySQL server and additional products, such as MySQL Shell, MySQL for Excel, MySQL for Visual Studio, but for our purposes of running WordPress, we really only need MySQL server, so choose "Server Only" and click "Next".

    Note: If it prompts you to install "Microsoft Visual C++ 2015-2019 Redistributable", add a checkbox to agree with the license terms and click "Install".
  • Installation
    In this step, you should see a list of products that will be installed. There should be "MySQL Server" product with the status "Ready to install". Click on "Execute". If successful, there should be a green checkbox next to the "MySQL Server" product with the status "Complete". Click on the "Next" button.
  • You should now be at "Product Configuration" step. In this step, we configure the products that we just installed, in our case, this would be MySQL Server with the status "Ready to configure". Click on "Next".

    On the left sidebar, you should now see steps to various configuration options.

    Windows MySQL Installation Step - Product Configuration steps

    • Type and Networking
      Config Type should be already set at "Development Computer". If not, set it and click "Next".
    • Authentication Method
      Here, we choose the recommended "Use Strong Password Encryption for Authentication" option. The other "Use Legacy Authentication Method (Retain MySQL 5.x Compatibility" is needed for PHP 7.2 or lower, but we used the latest PHP version which is currently PHP 8.
    • Accounts and Roles
      Here, choose a root password. Make sure that after typing and repeating the password you get the message "Password strength: Strong" and click "Next".

    • Windows Service
      Leave everything as it is. This way, MySQL will run as a service. Click "Next".
    • Apply Configuration
      Here, you will see a list of steps, the configuration needs to perform. Click on "Execute". This shouldn't last long (at most not more than a few minutes). When finished, if everything went without issues, all the steps should display green checkboxes. Click on the "Finish" button.
    • Product Configuration
      You should now see the "MySQL Server" product with the status "Configuration complete". Click "Next".
  • Installation Complete
    When we reach this step, the installation is done. We have an option to copy the installation log to the clipboard. Click "Finish".

After installation is completed, the MySQL Server should now run in the background of your system as a Windows service.

About MySQL configuration file

Before we go to the next step, let's talk about the MySQL configuration file for a moment. Similar to Apache, the MySQL Server also has a configuration file named my.ini where we can change & add various settings. For MySQL Server 8.0, the file is located at \ProgramData\MySQL\MySQL Server 8.0\

Default settings in my.ini file are fine and we don't need to change anything, but it is always good to know the location of configuration files in case we need to change settings in the future.

Note: Any change in the my.ini file will require restarting of MySQL.

In the next step, we are going to install a small utility MySQL Notifier utility to easily manage the MySQL service.

3.1. Download MySQL Notifier utility

During installation, we chose the default option to run MySQL Server as a Windows service. In order to easily stop / start / restart this service, we can download the MySQL Notifier utility. Click on the "Download" button, save the file and run the installer.

When we install it and run MySQL Notifier, a notification icon will appear on the taskbar from which we can easily stop, start or restart the MySQL server as shown below:

MySQL Notifier Notification Icon

Note: The install will make sure that the MySQL Notifier runs each time the Windows starts. To change that, right-click on the notifier icon and choose "Actions > Options" and deselect "Run at Windows startup".

4. Install phpMyAdmin tool

With a working MySQL server, we need to know how to manage MySQL databases and database users. For this purpose, we are going to use the PhpMyAdmin, a MySQL management tool written in PHP that we run on a browser from our localhost.

Download the phpMyAdmin

Go to the phpMyAdmin website and download it by clicking on the green "Download" button. Extract the downloaded file into your localhost root server folder.

About phpMyAdmin configuration file

The phpMyAdmin tool also has a configuration file named, but after extracting the files you will notice that it's missing. We are going to use a sample configuration file named, so open that file in the text editor.

Find the following line:

$cfg['blowfish_secret'] = '';

We need to put a random 32 characters long string as a value to this configuration setting. We can use this online tool that generates the $cfg['blowfish_secret'] containing the random secret. Copy this generated code and save the file as

Run the phpMyAdmin tool

To run the phpMyAdmin, open the browser and go to the following URL shown below. The X.X.X should be replaced with the phpMyAdmin version you are using.

If everything worked as it should, the phpMyAdmin will ask you for the login information:

phpMyAdmin Login Page

Use the root as username and password that you picked when MySQL was configured.

The phpMyAdmin dashboard should now show up:

phpMyAdmin Dashboard

Note: If you prefer GUI desktop applications, you could use a MySQL Workbench utility instead.

Possible Errors

The phpMyAdmin needs a PHP mysqli extension for it to work. We enabled this extension when we configured php.ini file at the beginning of this article when we modified the php.ini file. If it’s not enabled, we get the following error:

phpMyAdmin - Error
The mysqli extension is missing. Please check your PHP configuration.

5. Install WordPress

If you went through all the steps above, you should now have the Apache server, MySQL database, and phpMyAdmin tool installed. All that is left is to install WordPress.

First, download the WordPress, save the file on your system and extract it at your root server folder.

Note: The location of the root server folder is set in the Apache configuration file httpd.conf that we edited when we were setting up the Apache server.

Before we try to run the WordPress from our localhost, we need to make a MySQL database for our WordPress website and also create a database user that will have permission to this database.

5.1. Creating a Database and Database user for WordPress

We will use the phpMyAdmin tool to create a database and a database user for our WordPress website. The steps are as follows:

  1. Run the phpMyAdmin tool from our root server folder and login by using your MySQL login credentials.
  2. Once inside the phpMyAdmin dashboard, click on the "Databases" tab. Under the "Create database", there will be a text field. Type a database name you want to use and click on the "Create" button.
  3. After database creation, your tabs will change to manage this database. Click on the "Privileges" tab to manage database users for this database.
  4. Here, you should see the list of existing database users. We will create a new user. Click on the "add user account" link.
  5. Under "Login Information", we need to set:
    • Username
      Give it a name, for example, mywpuser. Remember it as we will need it later when we install WordPress.
    • Host name
      From the dropdown, change from "Any host" to "Local".
    • Password
      Choose a strong password. The easiest way is to click on the "Generate" button located below the "Password" field. It will generate one for you. This password will be used when we will install WordPress, so save it temporarily somewhere on your computer.

Now scroll all the way down and click the "Go" button located on the bottom right corner to save the settings. If everything went without issues, you should see the green "You have added a new user." message.

We have now created a WordPress database that is currently empty and also created a new database user account for this database. Both will be used in the next step.

5.2. Running WordPress Installation

To install WordPress, we first navigate to the URL of the folder with extracted WordPress files in our localhost which in our case should be:

This should redirect you to:

There are several steps we need to go through.

  1. In first step, we select the language that will be used in the Dashboard (back-end) and is not related to the language your Website will be having (front-end). Select a language and click on "Continue" button to go to the next step.WordPress installation step - select language

    Note: Check this WordPress official page to learn more about WordPress and languages for both front-end and back-end.
  2. Now, we are going to see a page with a bit more explanation on how the installation will proceed. We are going to fill out the database information and they will be saved into a configuration file named wp-config.php. We created those database credentials from the previous section when we were inside the phpMyAdmin tool. Clicking on "Let’s Go!" will move us to the next step.
    Note: If you are not seeing this page, but was instead moved to step 5 of the installation, it means that the wp-config.php configuration file already exists in the WordPress root folder. To modify the database credentials, simply edit the wp-config.php file in the text editor.
  3. In this step, we are going to fill in the database information:
    WordPress installation step - enter databaase informationWe need to fill the fields shown above.

    • Database Name
    • Username
    • Password

    For the Database Name, Username & Password, enter the values used when we created the database earlier using phpMyAdmin.

    • Database Host
      Leave it at localhost as the database is on the same machine.
    • Table Prefix
      Leave it as it is. This will add a prefix wp_ to the database tables generated with this installation.

    Click the "Submit" button. This information will be saved in wp-config.php file inside the WordPress root folder. If we need to modify any of these settings again in the future, we edit the wp-config.php file in the text editor.

  4. If everything was entered correctly, WordPress should now be able to communicate with the database and we should see the message shown below:WordPress installation step - run the installation

    Click on the "Run the installation" button to continue to the next step.

    On the other hand, if there is an issue and WordPress cannot establish a database connection, you might get one of the following errors:

    • Error establishing a database connection
      This error will contain the following message:

      This either means that the username and password information in your wp-config.php file is incorrect or we can’t contact the database server at localhost. This could mean your host’s database server is down.

      • Are you sure you have the correct username and password?
      • Are you sure you have typed the correct hostname?
      • Are you sure the database server is running?

      Open the wp-config.php file inside a text editor and check if the database name, database username, and database user password is the same as the one you used when creating database using phpMyAdmin earlier. Also, check if the MySQL is running by using the MySQL Notifier utility we installed in the previous section.

    • Fatal error: Uncaught Error: Call to undefined function mysql_connect()

      Check if you have the mysqli extension enabled in the php.ini file. We modified this file at the beginning when we were installing PHP.

    • There has been a critical error on your website.

      Similarly as with the previous error, first check if the mysqli extension is enabled in the php.ini file. If this is not the issue, check this article about the critical error during WordPress installation.

  5. In this step, we now need to fill in the information regarding the WordPress website.

    WordPress installation step - enter website information

    Note: Everything here can be later changed in the dashboard except for username. To change the username, we can use the Easy Username Updater plugin.

    We will set the following:

    • Site Title
    • Username
    • Password

    The username and password we enter here are the login information for the administrator user and are used to login into a WordPress Dashboard. Don't confuse them with the database username and password.

    • Your Email
      We also need to fill the email and can be used for password reset of the administrator account, but for the email to work, we also need an email server running.
      Note: If you forget your password on your local machine, check this official WordPress page that shows you different ways to reset the password.
    • Search engine visibility
      There is also a "Search engine visibility" checkbox, but this is used when a website goes live, so we can ignore this. In our case, the Apache only listens to, so it’s unreachable by search engines.
      Note: For live websites, do not rely on this checkbox to make your website hidden from search engines as it is up to search engines to honor this option. If you wish to limit who can see the website, you could use a plugin such as Restricted Site Access.

    Click "Install WordPress" to continue.

  6. If the installation completes successfully, you should see the following page:Wordpress Installation step - installation completed successfully

    Click on "Log in" button.

  7. You should now see the default WordPress login page:Wordpress - login page
    Note: To access the admin dashboard in the future, add /wp-admin/ path to the end of the URL of your installed WordPress website.

    After successful login, you should see the dashboard as shown below:

    Wordpress- Dashboard after login

If you made it this far, Congratulations. You are now running a WordPress website locally on your Windows machine.


In this article, we learned how to run WordPress locally on Windows systems. We had to first install PHP, Apache server, and MySQL database. For easy management of the MySQL database, we installed the phpMyAdmin tool and for easier management of the MySQL service, we installed MySQL Notifier utility. After that, all that was left was to install WordPress.


Click HERE to add your Comment
  1. James
    September 9, 2021
  2. Simon.Hsu
    September 25, 2021
  3. Kenny
    October 21, 2021
    • admin
      October 22, 2021
  4. Miklós
    January 3, 2022
  5. Michael Red
    April 27, 2022
  6. Jameel
    May 30, 2022
    • admin
      May 30, 2022
  7. apple1013
    June 22, 2022
  8. Jameel
    July 9, 2022
    • admin
      July 9, 2022
      • Jameel
        July 11, 2022
        • admin
          July 11, 2022
  9. Jan G
    July 28, 2022
    • admin
      July 30, 2022
  10. Wayne Mc
    August 15, 2022
    • admin
      August 15, 2022
      • Wayne Mc
        August 15, 2022
      • Wayne Mc
        August 15, 2022
        • admin
          August 15, 2022
    • Wayne Mc
      August 15, 2022
  11. nasim
    January 31, 2024
  12. Doug GS
    May 9, 2024

Write a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.