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
Warning when using Matomo + WordPress: "Warning: session_cache_limiter(): Cannot change cache limiter when session is active ..." #12963
Comments
It sounds like you have |
hm. NOT explicitly set anywhere in my config -- at all. That said, as you say it should be default, I added an EXPLICIT config to my php.ini
|
Have the same Error.
WP: 5.1.1–de_DE It not appears on a second Webspace with: Both are on the same shared Webspace with the same configuration (which I could not change) and same .htacces |
I just noticed my error log full of this warning for months. I can confirm this is real. Maybe a combination of WordPress and shared hosting environments where you're limited to what you can do. Any way to fix this on Matomo's side? |
Getting this on PHP 7.3, as well.
You probably need to check if the session's initialized already before running |
Ok, got this error when upgrading from php7.0-fpm to php7.3-fpm - 7.2 is where the session logic changed, per experience. It was on the dashboard, where I should see my stats, and WP-Matomo is configured to "Self hosted (PHP API)" because yes, it's on the same box. Shouldn't this mean that it's WordPress that is starting the session, not the PHP API? If so, there would be a question of WHY Matomo is trying to modify session behavior. My assumption is that the default HTTP API would not have similar behavior, but that's timing out on my configuration, so I can't test. Welp. As this looks like bootstrap.php is used in other contexts, would replacing
With
Work as a general case? (It make my wp dashboard error-free) |
When you install Matomo on the same box as WordPress, it doesn't mean that WordPress is starting any session since they are still separate applications unless you refer here to the actual WP Matomo plugin that is causing the issue? In the code you mention why should nocache only be set for PHP 7.2+? |
I said the logic made me error-free, not that it was correct. Sorry @tsteur , It was late. Should be somthing closer to this:
The reported behavior does not effect WP-Matomo's tracking calls (which would be separate php sessions, because they are seperate http(s) calls), only the backend statistics display (which I can find no provision to keep the Matomo-managed PHP session seperate from the WordPress-managed PHP session) If WP-Matomo is calling the PHP API incorrectly, without enough session isolation, that would also make sense. |
Sorry I'm not so much into it. Could you tell us how your WordPress / WP-Matomo / Matomo is set up? Like do you bootstrap Matomo somehow within WordPress? What tracking mode do you have configured in WordPress Matomo? Not sure what you mean by viewing the "backend statistics"? |
@tsteur WP-Matomo offers two options to get data from Matomo (Tracking code & site ID but also stats which are shown in the WordPress backend): HTTP API and PHP API. The HTTP (=REST) API typically works great, but the PHP API may cause conflicts (duplicate class names, sessions, ...), because it has to include several core Matomo PHP files into WordPress (the PHP client is still mentioned here, but the documentation behind the link describes the REST API only). Setting Matomo constants: https://github.com/braekling/WP-Matomo/blob/master/classes/WP_Piwik.php#L782
And here the API calls are done: https://github.com/braekling/WP-Matomo/blob/master/classes/WP_Piwik/Request/Php.php#L25
|
@braekling @Sudrien I'd be quite curious to look into this more. AFAIK wordpress does not have any session logic themselves and is basically not using |
Or maybe it's more a general problem with that server setup and it is not related to wordpress at all basically? |
@Sudrien |
@Sudrien @zerosonesfun could you maybe try this patch? Not sure if it helps but in that case if another plugin starts a session already, we would not start another one https://github.com/matomo-org/matomo/pull/14896/files |
It's running, but it doesn't fix the original error. ...which yeah, the test in bootstrap.php could be shortened to
|
Not sure which boostrap.php you refer to? |
Thanks! I will update the patch. Didn't realise it was there as well. |
Updated the PR |
* If session was already started, do not start it again refs #12963 refs https://forum.matomo.org/t/an-error-occurred/32500 * Update Session.php * Update bootstrap.php * add test
I've installed
on Nginx v1.14.0
It's working as expected as a standalone instance.
I've also installed
It's connected & tracking at my site
In my WP site's Admin UI, I see this warning on each page:
I asked about this is WP-Matomo support forum @
https://wordpress.org/support/topic/session_cache_limiter-warnings-when-wp-piwik-is-enabled/#post-10311647
where the response by plugin's dev @braekling included
So, I'm checking here next.
Notice: Constant PIWIK_ENABLE_SESSION_START already defined in /srv/www/piwik/bootstrap.php on line 8
I did find this old issue by @robocoder
#885
which seems to be (?) related, but looks like it was fixed long ago.
I did try adding
or
to Matomo's
piwik/bootstrap.php
, but that doesn't change the behavior. I just getWhat in Matomo core code or config needs to be changed to correct this session_cache_limiter issue when used with WP/WP-Matomo plugin?
Or is this not a Matomo issue either, and needs to be raised @ WP Core?
The text was updated successfully, but these errors were encountered: