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

MultiSites Plugin - getEvolutionGraph no graphs when using php-fpm (apache/nginx) ! #14445

Closed
fskale opened this issue May 13, 2019 · 5 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.

Comments

@fskale
Copy link

fskale commented May 13, 2019

Version: 3.9.1
Webserver: apache2/nginx using php-fpm
When using php-fpm and not the native apache2 module, the FastCgi handler must point to an php file in the request uri.
However, the multisite plugin is broken, because the pwiki_url refers to / and therefore the fpm handler won't be triggered.
E.g.: nginx config snippet:

## only allow accessing the following php files
    location ~ ^/piwik/(index|matomo|piwik|js/index).php {
      include snippets/fastcgi-php.conf;
      fastcgi-php config replace this with the one from this repository
      fastcgi_param HTTP_PROXY "";
      fastcgi_pass unix:/var/run/php/piwik-fpm.sock; #replace with the path to your PHP socket file
    }

My Simple fix for that issue:

--- site.controller.js	2019-05-13 09:15:34.649259158 +0200
+++ site.controller.js.new	2019-05-13 09:11:18.251398270 +0200
@@ -41,7 +41,7 @@
                     break;
             }

-            return piwik.piwik_url + '?module=MultiSites&action=getEvolutionGraph&period=' + $scope.period + '&date=' + $scope.dateSparkline + '&evolutionBy=' + metric + '&columns=' + metric + '&idSite=' + website.idsite + '&idsite=' + website.idsite + '&viewDataTable=sparkline' + append + '&colors=' + encodeURIComponent(JSON.stringify(piwik.getSparklineColors()));
+            return piwik.piwik_url + 'index.php?module=MultiSites&action=getEvolutionGraph&period=' + $scope.period + '&date=' + $scope.dateSparkline + '&evolutionBy=' + metric + '&columns=' + metric + '&idSite=' + website.idsite + '&idsite=' + website.idsite + '&viewDataTable=sparkline' + append + '&colors=' + encodeURIComponent(JSON.stringify(piwik.getSparklineColors()));
         }
     }
 })();

Should i create a pull request ?
Thanks in advanced
Franz

@tsteur
Copy link
Member

tsteur commented May 13, 2019

PR sounds good 👍

@tsteur tsteur added the Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. label May 13, 2019
@fdellwing
Copy link
Contributor

fdellwing commented May 13, 2019

Just to make this clear, this is not a problem for everyone, it works perfectly fine for us.

This is our php-fpm snippet:

location ~ ^/(index|matomo|piwik).php {
    fastcgi_split_path_info ^(.+?\.php)(|/.*)$;
    fastcgi_pass   unix:/var/run/php/php7.2-fpm.sock;
    fastcgi_index  index.php;
    fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
    fastcgi_param  HTTP_PROXY "";
    include        fastcgi_params;
}

Screenshot_20190513_094540

@Findus23
Copy link
Member

I also use Nginx with PHP-fpm (as explained in https://github.com/matomo-org/matomo-nginx) and it works for me. (As it expect ?= urls to work)

But the change also doesn't hurt, so it should be okay.

@fdellwing
Copy link
Contributor

@Findus23 It seems like it works if index index.php index.html; or simply index index.php; is present in the server block. As this should always be the case in a clean configuration very little people should be affected by this.

But as you said, it does not hurt. So go for it.

@fskale
Copy link
Author

fskale commented May 13, 2019

Hi,
thanks @fdellwing for the hint.
We use matomo in a subdir, so we configured the index to only be /site/index.php.
Adding index.php worked perfectly.
IMHO, a PR is not necessary anymore, or is it ?
Thanks for the superfast help !
Best regards
Franz

@fskale fskale closed this as completed May 13, 2019
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Jun 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

No branches or pull requests

5 participants