Matomo automated setup


First of all, Thanks for the wonderful application!. I didnt know analytics was this easy before coming across matomo!!.

I am trying to automate setup of matomo. Access to db is all fine and I can access db from ssh and from matomo.

To test how much of setup can be automated, I created matomo/config/config.ini.php and matomo/config/global.ini.php with proper database configurations in a matomo installation which do not have any database configured. I accessed the matomo page (this page works if configs are not edited) and encountered with an error

Your host may have disabled parse_ini_file()

I faced the same situation as mentioned in the link above. After creating and updating matomo/config/global.ini.php with proper database config, I faced another error

Cannot connect to the database:

**SQLSTATE[HY000] [2002] Connection timed out**

I think this stage can be automated because this is already automated in bitnami imagtes. Any help is much appreciated


I came across this plugin extra-tools I followed read me and executed console matomo:install --install-file=install.json but installation haled with below errror

./console matomo:install --install-file=install.json 
Are you really sure you would like to install Matomo - if you have an installation already, it will be wiped? y
ERROR [2021-06-18 13:13:57] 18721  Uncaught exception: Error: Class 'Symfony\Component\Process\Process' not found in /var/www/html/matomo/plugins/ExtraTools/Lib/Drop.php:32
Stack trace:
#0 /var/www/html/matomo/plugins/ExtraTools/Commands/InstallMatomo.php(233): Piwik\Plugins\ExtraTools\Lib\Drop->execute()
#1 /var/www/html/matomo/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Piwik\Plugins\ExtraTools\Commands\InstallMatomo->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#2 /var/www/html/matomo/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#3 /var/www/html/matomo/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\ExtraTools\Commands\InstallMatomo), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 [internal function]: Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 /var/www/html/matomo/core/Console.php(130): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/html/matomo/core/Access.php(673): Piwik\Console->Piwik\{closure}()
#7 /var/www/html/matomo/core/Console.php(131): Piwik\Access::doAsSuperUser(Object(Closure))
#8 /var/www/html/matomo/core/Console.php(82): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/html/matomo/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/html/matomo/console(32): Symfony\Component\Console\Application->run()
#11 {main}
Uncaught exception in /var/www/html/matomo/plugins/ExtraTools/Lib/Drop.php line 32:
Class 'Symfony\Component\Process\Process' not found


This seems to be this issue:

Thanks for help!

I tried installing composer and instated composer component. Now that error is gone but, I am seeing another error

[Fri Jun 18 13:44:24.530455 2021] [php7:error] [pid 322] [client <ip>:27968] PHP Fatal error:  Uncaught Error: Class 'Piwik\\Plugin\\Manager' not found in /var/www/html/matomo/core/bootstrap.php:48\nStack trace:\n#0 /var/www/html/matomo/index.php(19): require_once()\n#1 {main}\n  thrown in /var/www/html/matomo/core/bootstrap.php on line 48

I cant find any folder by the name Piwik in installation directory

[root]# find /var -name piwik
[root]# find /var -name Piwik


This class should be defined here:

I checked and can see the class at the proper location. I will list what I did

  1. Setup webserver
  2. Installed matomo
  3. Changed DocumentRoot in httpd conf - (Done to make matomo accessible on domain root)
  4. Loaded matomo on browser to make sure matomo is loading as expected
  5. Tried automated installation using ExtraTools plugin

Am I missing anything? I have tried till step 4 many tmes and I was always able to see matomo welsome page and I was able to do the rest of the setup as well. All I want to do is to automate matomo instalaltion

I am seeing the error Required private directories. I tried running matomo console command as in the documentation but it didnt help. As said in the diagnostic warnings, I can access those files from browser.

Can you advise me on the proper permissions to set to below directories/files?

  • config/config.ini.php
  • /tmp/cache/tracker/matomocache_general.php
  • /tmp/empty
  • /tmp

Update: This is done. I thought this is a matomo ability which can be achieved through matomo console script. I tried blocking from webserver and it worked