Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation process won't create config.php.ini file on Heroku #12548

Closed
AndoniLarz opened this issue Feb 11, 2018 · 5 comments
Closed

Installation process won't create config.php.ini file on Heroku #12548

AndoniLarz opened this issue Feb 11, 2018 · 5 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@AndoniLarz
Copy link

Hello,

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 :

[General]
session_save_handler = dbtable

[database]
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
Copy link

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

@LinzerToertchen
Copy link

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
Copy link
Member

tsteur commented Oct 29, 2018

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

@LinzerToertchen
Copy link

Untested, but this should work.

@Findus23
Copy link
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

@Findus23 Findus23 added the answered For when a question was asked and we referred to forum or answered it. label May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

5 participants