@AndoniLarz opened this Issue on February 11th 2018


I've been trying to install Matomo on an Heroku free dyno, to test it.
I downloaded Matomo on my PC and pushed it on Heroku.
My first problem is that, as you may know, Heroku uses ephemeral filesystem and free dynos sleep after 30 minutes of inactivity. This causes the installation process to be triggered every time the dyno is woken up.

It looks like the solution is to store sessions in the database using the session_save_handler = dbtable in the [General] section of my config/config.ini.php file.
As far as I understand, this config.ini.php file must be generated automatically at the end of the installation process, correct me if I'm wrong.
So my current problem is that I push the matomo code to Heroku, I process the installation via the web interface, but it doesn't create a config.ini.php.

If I try to create it myself, with only thesession_save_handler = dbtable line before pushing to Heroku, it doesn't work and throws MySQL errors :

Cannot connect to the database:

SQLSTATE[HY000] [2002] No such file or directory

If I create it and add all this code :

session_save_handler = dbtable

host = "<?php echo(getenv('DATABASE_HOST')); ?>"
username = "<?php echo(getenv('DATABASE_USER')); ?>"
password = "<?php echo(getenv('DATABASE_PASSWORD')); ?>"
dbname = "<?php echo(getenv('DATABASE_NAME')); ?>"

I get another type of error :

Cannot connect to the database:

SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known

So I'm kinda lost right now since I guess I should use the config.ini.php, but if I use it I'm getting errors.

@vickyveera10 commented on February 22nd 2018

I got same this issue ,In heroku php using create a config file its not working please anyone know how to fix this ..

@HaehnleinMar commented on October 29th 2018

The config.ini.php is read as an ini file, that's why it states ; <?php exit; ?> DO NOT REMOVE THIS LINE.

; starts a comment and <?php exit; ?> stops the PHP interpreter from leaking any config values.

@tsteur commented on October 29th 2018 Member

maybe you can give us access to the server to have a look at it? feel free to email us at hello at matomo.org

@HaehnleinMar commented on October 31st 2018

Untested, but this should work.

@Findus23 commented on May 24th 2020 Member

Adding PHP code to the config.ini.php won't work as it is an .ini file.

But in the meantime it is possible to configure Matomo via environment variables: https://plugins.matomo.org/EnvironmentVariables

This Issue was closed on May 24th 2020
Powered by GitHub Issue Mirror