This page covers all the steps from installing Matomo Analytics on Windows including setting up MySQL, PHP, IIS and the scheduled task.

How do I install and configure MySQL on Windows for Matomo

In this FAQ we will provide step-by-step instructions on how to Install MySQL on Windows for use with Matomo.

Install MySQL

It is recommended that you install MySQL on a dedicated server rather than installing MySQL on the same server that that you are running IIS on. The separation of the database server and Web server makes overall installation more secure and manageable and avoids resource contentions between the database and Web server processes.

  1. Download MySQL Community Server. We recommend downloading and using the Windows Installer.
    Note: The MySQL Installer is 32 bit, but the installer will install both 32 bit and 64 bit binaries.

  2. Start Windows Installer, or extract all the files from the archive, and then start Setup.exe.

  3. You can use a Typical Setup or customize the installation to suit your needs.
    Please see below for the detailed setup process including screenshots.

  4. Once the installation wizard is completed, it is recommended that you leave the Configure the MySQL Server now checkbox selected.

Select Server Only

Select Execute

Select Next

Select Standalone MySQL Server / Classic MySQL Replication then Next

Click Next

Unless you have specific requirements do not change the settings on this screen, click Next

Unless you have specific requirements do not change the settings on this screen, click Next

Create a strong and secure MySQL root password

Unless you have specific requirements do not change the settings on this screen, click Next

Click Execute

The installation will complete, on the following screens click Next, then click Finish

Secure MySQL

Then we run the MySQL secure installation tool to improve the default security settings:

Open Explorer and search for mysql_secure_installation.exe. Once you find the executable file, you can run this executable file.

When you run this executable file a window will pop up that will walk you through the process of securing your MySQL installation. We recommend to answer Yes to all the questions.

That’s it!

Create a Mysql database and user

Assuming your MySQL server is running, now we will create a new MySQL database for Matomo and a new MySQL user who can only access this database.

  1. Open the MySQL command prompt by clicking Start -> All Programs -> MySQL -> MySQL Server -> MySQL Command Line Client:

  2. Enter the password for the root account.

Once logged on to MySQL, use the following sequence of commands:

  1. Create a database for Matomo:

    $ mysql> CREATE DATABASE matomo_db_name_here;

  2. Create a user called matomo:

    $ mysql> CREATE USER 'matomo'@'localhost' IDENTIFIED BY 'my-strong-password-here';

  3. Grant this user matomo the permission to access your matomo_db_name_here database

    $ mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON matomo_db_name_here.* TO 'matomo'@'localhost';

In these instructions:

  • replace matomo_db_name_here with the name of your MySQL database dedicated to Matomo Analytics.

  • replace my-strong-password-here by a strong secure password.

  • replace ‘matomo’ by your chosen MySQL username (or simply use ‘matomo’).

Configure MySQL

Locate your MySQL configuration file called C:\ProgramData\MySQL\MySQL Server X.X\my.ini and set the following values:

max_allowed_packet = 256M

wait_timeout = 28800

Restart MySQL to apply these changes.

Best Practices for MySQL

  • Enable TCP/IP Networking — This is the default. Keep the TCP port that MySQL uses to listen at 3306. If the database will be running on a separate system from the Web server, select the Add firewall exception for this port check box.

  • Include ‘Bin’ Directory in Windows PATH — This makes the MySQL utilities available from the command prompt or from Windows PowerShell™.

  • Create an Anonymous Account — The default is to keep this disabled. Adding anonymous user support may create a security risk for the database; additionally, enabling anonymous users causes the GRANT statements used to set up database to be unreliable.

MySQL should now be successfully setup on your Windows server.

Next we’ll take you through setting up PHP for Windows: How do I install and configure PHP on Windows for Matomo?
If you already have PHP setup, you can continue with the next step of setting up IIS for Windows: How do I install and configure IIS on Windows for Matomo?
Once you have everything setup, don’t forget to setup a scheduled task for archiving reports in Matomo.

How do I install and configure PHP on Windows for Matomo?

Once you’ve setup MySQL on Windows for Matomo, we can continue with setting up PHP using our step-by-step guide below.

Install PHP

  • Download PHP Thread Safe and select the right processor architecture (64 bit or 32 bit)

  • Extract the content of this file to the root of your data drive in a PHP directory, for example: C:\PHP

  • Add php.exe to the system’s path environment variables.
    From the Command Prompt (Admin), run:

C:\>setx PATH "%PATH%;C:\PHP" /M

​This should return the following:

SUCCESS: Specified value was saved.

You can then type the following to exit the Windows Command Line:


Ensure that you can run PHP from the Windows Command Line

To test if the PHP installation is successful, run the following from the command line prompt:

php -m

You may get the following error screen when trying to run php:

In which case you should download and install the Visual C++ Redistributable for Visual Studio 2015 from the following link:

Configure PHP and load all required PHP extensions

Several PHP extensions are required in order to run Matomo Enterprise. Most (but not all) of required extensions are enabled by default in PHP7. Required extensions include: PDO with MySQL driver, GD, json, libxml, dom, SimpleXML, zlib, SPL, iconv, mbstring, Reflection.

Follow these instructions to configure PHP to install Matomo:

  • Navigate to the PHP folder and copy the php.ini-production file and rename it to php.ini

  • Open the C:\PHP\php.ini file with your favorite text editor

  • Find the extension_dir directive and change so that it properly locates the ‘ext’ folder, i.e.:

extension_dir = "C:\PHP\ext"
  • Similarly, configure the session path to point to your temp folder:
session.save_path = "C:\Windows\Temp"
  • Next, configure the memory limit:
memory_limit = 2G
  • Next, configure the maximum execution time:
max_execution_time = 600
  • Next, enable the logging of errors in the error log file:
log_errors = On
  • Next, disable the logging of errors on screen:
  • Enable the following Extensions used in PHP by Matomo.
    Add the following lines at the top of the file under the [PHP] section:
; Activate PHP extensions required by Matomo

  • ​Save the file as php.ini

You can now test that PHP still works by running in the command from the Windows Command Line:

php -m

Note that at the start of the installation process, Matomo will automatically report if any of the required PHP extensions are missing from your system. And when you have installed Matomo successfully, you can open the system check at any time by going to Matomo > Administration > Diagnostic > System Check.

PHP should now be successfully setup on your Windows server.

Next we’ll take you through setting up IIS for Matomo on Windows: How do I install and configure IIS on Windows for Matomo?
If you don’t already have MySQL setup, you can follow the steps in our guide on setting up MySQL for Windows here: How do I install and configure MySQL on Windows for Matomo?
Once you have everything setup, don’t forget to setup a scheduled task for archiving reports in Matomo.

How do I install and configure IIS on Windows for Matomo?

Now that we’ve setup MySQL and PHP on Windows for Matomo we can finally setup IIS to act as the Matomo web server using the guide below.

Install IIS

This differs across Operating systems. Please search for IIS installation online if the below guide does not match your OS.

  1. First of all, select the Control Panel.

  2. In the Programs section, select Turn Windows Features on or off.

  3. You might encounter the following screen:

  4. Now, simply click on the features that are checked on the following screens and then hit the OK button.

  5. A progress bar will appear.

  6. Once the installation is over, to confirm it, simply type the following URL into your browser: http://localhost.
    If installation is successful, then you will see a IIS page.


Configure IIS to treat index.php as the default content page

  1. To open IIS Manager, click Start, type iis in the Search Programs and Files box, and then press Enter.

  2. Select and open Default Document at the server level:

  3. Click Add… and enter index.php:

Configure IIS to handle PHP files

  1. Click Handler mappings:

  2. Click Add Module Mapping from the right hand menu:

  3. Configure the dialog as shown below:

  4. Click OK.

  5. A prompt will ask if you want to add this as a fastCGI application. Select no.

Configure IIS bindings

  1. Open IIS Manager and select your website that contains Matomo.

  2. Then select Bindings …

  3. Select Add …

  4. Enter the domain for your Matomo, click OK.

  5. Confirm the binding has been added.

  6. Update your DNS entries to point towards the server.

Configure FastCGI timeout for IIS

Next we need to change the configured activityTimeout in the IIS Manager under the server/IIS/FastCGI Settings/Edit to a higher value than what is set to by default.
Depending on the amount of data the archiver will need to process, it may be necessary to increase the value to a very high number (such as 36000 or more – which is 10 hours) to allow the archiver to complete.
Not setting this to a higher value will result in the Matomo archiver not being able to process any reports.

Once this has been changed, you will need to restart the server for these changes to take effect.

You can also follow the steps below to change the Activity Timeout setting for example in IIS 7.5:

  1. Open InetMgr (Press the windows key+R then type Inetmgr and hit enter)

    open inet manager from run command

  2. Use the filter to search for FastCGI Settings

  3. Click on Edit… and proceed to change the Activity Timeout value to 36000 or more.

  4. Once the value has been changed, you will need to restart the server in order for the changes to take effect.

Please note: the steps to change this value may be different depending on which version of IIS you have installed.

Disable Request Filtering (for Heatmap & Session Recording plugin)

When using Heatmaps & Session Recording, in Settings > Diagnostics > System Check, you may encounter the following warning message:

Requesting '' resulted in an SSL error.
Maybe you are using a self signed certificate?
Please open the URL manually in a browser to see if the response contains 'Piwik.HeatmapSessionRecording'.
If not, you might need to modify your server configuration as this file needs to be accessible via a browser from the Internet or Intranet.

The issue is that requesting the URL path /plugins/HeatmapSessionRecording/configs.php results in a 404 error. This is likely caused by the feature « Request Filtering », a security feature that was introduced in Internet Information Services (IIS) 7.0.

To make Heatmaps & Session Recording work as expected, you can disable Request Filtering by following the steps below. You can also learn more about Request Filtering in the IIS documentation.

To disable Request Filtering:

  1. On the taskbar, click Start, point to Administrative Tools, and then click Server Manager.

  2. In the Server Manager hierarchy pane, expand Roles, and then click Web Server (IIS).

  3. In the Web Server (IIS) pane, scroll to the Role Services section, and then click Add Role Services.

  4. On the Select Role Services page of the Add Role Services Wizard:

    → un-select Request Filtering,\
    and then click Next.

  5. On the Results page, click Close.

Now that Request Filtering is disabled, in Settings > Diagnostics > System Check you should not see the warning anymore.

Verify the web server is responding

Create a file in c:\Inetpub\wwwroot called phpinfo.php In order to quickly verify that your web server is correctly configured to execute PHP scripts, you could create a file which contains:


When you visit this page at you see a similar phpinfo output:

Congratulations, your web server is running and correctly configured to handle PHP7 requests.

Copy Matomo to the webroot for IIS

Now that we have IIS setup we need to copy the Matomo files to the C:\Inetpub\wwwroot" folder

Download the latest release Matomo 4.6.2 from here:

Once Matomo has been downloaded, unzip the file and copy the contents of the matomo folder to the C:\Inetpub\wwwroot folder

Verify the Matomo console command is working

Next, open a command, and run the Matomo console to check it is working as expected:

php "c:\Inetpub\wwwroot\console"

The console command output will look like this:

Continue with the Matomo Installation

Once You have MySQL, PHP and IIS setup on Windows you can continue with the Matomo 5-minute installation.

Once the Matomo 5-minute installation is complete, Matomo should now be successfully setup and running on your Windows server.

Now that Matomo is running, we can continue to setup a scheduled task for archiving reports in Matomo.
If you haven’t already setup MySQL for Windows you can follow our guide here: How do I install and configure MySQL on Windows for Matomo?
You will also need to have PHP for Windows installed and setup according to our guide here: How do I install and configure PHP on Windows for Matomo?

How do I setup a scheduled task to process reports on Windows for Matomo?

This FAQ will take you through the steps to set up a Windows task which will trigger the processing and archiving of Matomo reports. This will make sure that when you visit your Matomo dashboard, the data has already been processed and Matomo will load reports quickly.

There are two ways to setup archiving for Matomo on Windows: Without logging and with logging, in the FAQ below you will find the steps to setup either method.

Creating a Scheduled Task without logging

  • Search for « Task Scheduler », or press the Windows Key + R and type taskschd.msc and press enter.

  • Click « Enable All Tasks History »

  • Click « Create Task »

  • Name the task e.g. « Matomo Auto Archiving » (in the General panel).

  • Click on the « Triggers » panel and click « New » to add a new trigger.

  • Select to create a trigger after a timetable, to be executed daily and every hour.

  • Go to the « Actions » panel and click « New… »

  • Select « Start a Program » as the action, and put the path to your php.exe file. Eg. C:\PHP\php.exe

  • Then in the « Add arguments (optional) » field, put the following value:
    "C:\path\to\matomo\console" core:archive --no-ansi --url="

  • Replace C:\path\to\matomo\ with the path to your Matomo root folder (which includes the « console » file)

  • Replace with the URL to your Matomo instance.

  • Click « OK » to close.

Next we’re going to do a test run of the Scheduled Task to ensure it executes correctly.

  • Click on the « Task Scheduler Library » and find the Matomo archiving task, and select it.

  • Click « Run ».

  • You should then see a console window open with the output from the archiver process:

Creating a scheduled task with logging

If you would like to have logs for the auto archiver, you will need to create a .bat file on the server that we will execute the archive task, follow the steps below to setup archiving with logging:

  • Create a new text file, and rename it to Matomo-Auto-Archiving.bat (be sure to change the file extension from .txt to .bat)

  • Right click on the Matomo-Auto-Archiving.bat file, and select « Edit »

  • Copy paste the following command into the file:
    C:\PHP\php.exe "C:\path\to\matomo\console" core:archive --no-ansi --url= > C:\path\to\log\folder\matomo-archive.log

  • Replace C:\path\to\log\folder\ with the path where the matomo archive log file containing the last archive output will be written

  • Replace C:\path\to\matomo\ with the path to your Matomo root folder (which includes the « console » file)

  • Replace with the URL to your Matomo instance

  • Then follow the steps as above to add the auto archiving as a scheduled task, but this time in the « Task Properties » field, select the Matomo-Auto-Archiving.bat file instead.

Note: The scheduled task will overwrite anything in the matomo-archive.log file and only keep the last archive log. If you would like the logs to persist over time, you may change the single > to a double >> in the command in the .bat file.
Note: appending to the log file can cause the log file size to grow considerably large, so only enable it when you need to troubleshoot errors with the scheduled archiving process.

Congratulations! You now should have a scheduled task on Windows setup to archive your Matomo reports automatically.
Now that we’ve setup a scheduled task, we can now disable browser archiving to help improve performance.