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: https://www.microsoft.com/en-us/download/details.aspx?id=48145.

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:
    (Note: For PHP 8.0 onwards please use php_gd.dll over php_gd2.dll)
; 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.

Previous FAQ: How do I install and configure MySQL on Windows for Matomo