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

Installer does not show up and requires config.ini.php #14169

Closed
Sebi2020 opened this issue Mar 8, 2019 · 9 comments
Closed

Installer does not show up and requires config.ini.php #14169

Sebi2020 opened this issue Mar 8, 2019 · 9 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@Sebi2020
Copy link

Sebi2020 commented Mar 8, 2019

Description

If you try to install a fresh version of Piwik / Matomo the installer does not show up because PHP throws an exception about a missing config.ini.php:

Uncaught exception: The configuration file {C:\Server\nginx\html\piwik/config/config.ini.php} has not
been found or could not be read. » Please check that C:\Server\nginx\html\piwik/config/config.ini.php is
readable by the user 'nt-autorit�t\system'. in
C:\Server\nginx\html\piwik\core\Application\Kernel\EnvironmentValidator.php line 80 #0
C:\Server\nginx\html\piwik\core\Application\Kernel\EnvironmentValidator.php(63):
Piwik\Application\Kernel\EnvironmentValidator->checkConfigFileExists('C:\\Server\\nginx...', false) #1
C:\Server\nginx\html\piwik\core\Application\Environment.php(185):
Piwik\Application\Kernel\EnvironmentValidator->validate() #2
C:\Server\nginx\html\piwik\core\Application\Environment.php(94): Piwik\Application\Environment
>validateEnvironment() #3 C:\Server\nginx\html\piwik\core\dispatch.php(28):
Piwik\Application\Environment->init() #4 C:\Server\nginx\html\piwik\index.php(27):
require_once('C:\\Server\\nginx...') #5 {main}

Steps to reproduce the bug

  1. Download Matamo 3.8.1
  2. Place it into your Nginx webroot
  3. Try to make a fresh install by navigating to the matamo folder with your favourite browser

Expected behaviour

Instead of complaining about the missing config.ini.php file the installer should be fired up to create one.

Environment

OS: Windows 10
DB: MariaDB
PHP: 7.0
Version: 3.8.1
Webserver: Nginx

@Sebi2020 Sebi2020 changed the title Installer requires config.ini.php Installer does not show up and requires config.ini.php Mar 8, 2019
@fdellwing
Copy link
Contributor

fdellwing commented Mar 8, 2019

Have you tried to give the named user write access to the config folder?

(And to the cache/tmp folder aswell)

@Sebi2020
Copy link
Author

Sebi2020 commented Mar 9, 2019

Yes, the user has write access to the folders. I just tested that

@tsteur
Copy link
Member

tsteur commented Mar 10, 2019

It should definitely fire the installer in that case unless you are on CLI? I assume that's not the case as you say navigate to your browser.

Maybe it thinks for some reasons that you are on CLI that would be pretty much the only explanation for me.

In core/Common.php around line 130 could you change the function isPhpCliMode like this:

public static function isPhpCliMode()
    {
return false;
}

@Sebi2020
Copy link
Author

Sebi2020 commented Mar 11, 2019

This at least caused the script to show the installer but now it complains (it shows a red warning) that my browser isn't able to load scripts and stylesheets. It just presents me with a plain html page.

@tsteur
Copy link
Member

tsteur commented Mar 11, 2019

That might be some other server issue. I see you are using Nginx, maybe try this config here? https://github.com/matomo-org/matomo-nginx/ not sure if it helps. But for such server issues the forum be the best: https://forum.matomo.org and a google search for matomo and not loading scripts or stylesheet might help as well.

In case you are familiar with PHP, could you check which of the two checks result in true meaning where it falsely detects your system is in cli mode? https://github.com/matomo-org/matomo/blob/3.9.0-b3/core/Common.php#L134-L140

eg does it still show the installer when you do

  public static function isPhpCliMode()
    {
        if (is_bool(self::$isCliMode)) {
            return self::$isCliMode;
        }
        if(PHP_SAPI == 'cli'){
            return true;
        }
    return false;
    }

and when doing this:

   public static function isPhpCliMode()
    {
        if (is_bool(self::$isCliMode)) {
            return self::$isCliMode;
        }
        if(PHP_SAPI == 'cli'){
            return true;
        }
        
        if(self::isPhpCgiType() && 1){
            return true;
        }
        
        return false;
    }

@Sebi2020
Copy link
Author

Sebi2020 commented Mar 11, 2019

The third check failed due to an configuration error in nginx. My fastcgi.conf wasn't properly loaded which caused the third if to be true. Sorry. I never expierenced problems because of REMOTE_ADDR not being present. That's why I thought this was a bug.

@tsteur
Copy link
Member

tsteur commented Mar 11, 2019

Maybe we should replace this with \Piwik\IP::getIpFromHeader(). Do you know if in your case the IP is maybe set in another Header/$_SERVER entry?

@Sebi2020
Copy link
Author

Sebi2020 commented Mar 12, 2019

I don't actually know the difference, but in my case this was really just a misconfiguration. No header contained the remote ip at all:

It seems that it is really important at which line you include fastcgi.conf and that was my problem.
The server was previously configured to pass only these variables:

    SYSTEM ENVIRONMENT VARIABLES
    ...
    [HTTP_ACCEPT_LANGUAGE] => de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7
    [HTTP_ACCEPT_ENCODING] => gzip, deflate, br
    [HTTP_ACCEPT] => text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
    [HTTP_DNT] => 1
    [HTTP_USER_AGENT] => Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.121 Safari/537.36
    [HTTP_UPGRADE_INSECURE_REQUESTS] => 1
    [HTTP_CACHE_CONTROL] => max-age=0
    [HTTP_CONNECTION] => keep-alive
    [HTTP_HOST] => localhost
    [SCRIPT_NAME] => C:\Server\nginx/html/test.php
    [SCRIPT_FILENAME] => C:\Server\nginx/html/test.php
    [FCGI_ROLE] => RESPONDER
    [PHP_SELF] => C:\Server\nginx/html/test.php
    [REQUEST_TIME_FLOAT] => 1552351190.6844
    [REQUEST_TIME] => 1552351190

@tsteur
Copy link
Member

tsteur commented Mar 12, 2019

Thanks.

@tsteur tsteur closed this as completed Mar 12, 2019
@tsteur tsteur added the answered For when a question was asked and we referred to forum or answered it. label Mar 12, 2019
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

3 participants