To create reports, Matomo archives data from your visitor logs. In the Matomo for WordPress plugin, this process is completed in one of two ways:

  • Either by an asynchronous process
  • By a CURL request.

You can check which mode your site will use on the Matomo Analytics > Diagnostics page by looking at the the value for Supports Async Archiving.

The asynchronous process is made by a call from Matomo. The PHP interpreter used to execute this file is chosen by custom logic in Matomo.

In a Uberspace hosting environment, your WordPress database credentials are stored in a dedicated INI file which is parsed by PHP. And they are used in your wp-config.php using the get_cfg_var instruction.

The Matomo problem in the Uberspace hosting

The problem is the PHP Cli intepreter used by Matomo in a Uberspace environment is not the default /usr/bin/php one. Your WordPress INI configuration file is loaded when calling /usr/bin/php, but not with the PHP Cli identified by Matomo. So the Matomo schedule tasks in asynchronous mode will fail because they are not able to load your database credentials.

Solutions for using Matomo for WordPress in a Uberspace environment

There are several possible solutions for successfully running Matomo within a Uberspace environment detailed below.

A) Copy the database credentials into your wp-config.php file

You can either copy your database credentials from your WordPress INI file to your wp-config.php file. In this case, no matter which PHP Cli used, if WordPress is loaded, the database credentials will be known. Access to your credentials will no longer depend on your WordPress INI configuration file.

B) Ask Uberspace to also load your WordPress INI file from the PHP Cli used by Matomo

This PHP Cli has the following structure:

/opt/%user%/php%phpversion%/root/usr/bin/php

C) Force Matomo to use the default PHP Cli

You can do it by editing the following INI file: wp-content/uploads/matomo/config/config.ini.php

In this file, there is a [general] section. Under this section, add the following line:

php_binary_path="/usr/bin/php"

Once your update config file is saved, visit Matomo analytics > Diagnostics > Troubleshooting in your WordPress menu and click the Clear Matomo cache button.

D) Disable the Matomo asynchronous mode

You can disable the Matomo asynchronous mode for WordPress in one of two ways:

You can add the following snippet of code in your wp-config.php file:

if (!defined('MATOMO_SUPPORT_ASYNC_ARCHIVING')) {
    define('MATOMO_SUPPORT_ASYNC_ARCHIVING', false);
}

D) 2. Enable the WP_DEBUG mode

While WP_DEBUG is enabled for a WordPress site, the Matomo asynchronous process is disabled by the plugin. To enable this mode, please add the following content in your wp-config.php file:

if (!defined('WP_DEBUG')) {
    define('WP_DEBUG', true);
}

More information about the WordPress debug mode can be found here

Previous FAQ: How do I solve it when form submissions don’t work anymore with the Ultimate Member plugin?