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

session_start() issue #11491

Closed
dev-101 opened this issue Mar 15, 2017 · 5 comments
Closed

session_start() issue #11491

dev-101 opened this issue Mar 15, 2017 · 5 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@dev-101
Copy link

dev-101 commented Mar 15, 2017

Hi, I am using an auto-prepend script which requires sessions for proper operation.
This conflicts with Piwik, which also tries to start own session, generating notices with each request, filling up the logs quickly (and most importantly, can't log in or access reports).

My question is how hard would it be to implement a simple logic that checks if the session already exists, e.g.:

if(!isset($_SESSION)) session_start();

I have read many older topics, and I am aware of the alternative to store sessions into db, which I do not really want. I wonder why is this so hard to implement - do you have a particular reason for it?

Thanks

@sgiehl
Copy link
Member

sgiehl commented Mar 15, 2017

Why don't you try to disable you auto-prepend file using .htaccess? Or aren't you using Apache?

@dev-101
Copy link
Author

dev-101 commented Mar 15, 2017

Hi, well, yeah, there is that option as well, I have root access.
But, I was just wondering - why is this the way it is?
And auto session start can sometimes come in handy, so I would like to keep it if possible.

@mattab
Copy link
Member

mattab commented Mar 21, 2017

Thanks for the report. Feel free to open a pull request, otherwise we won't fix this ourselves.

@mattab mattab closed this as completed Mar 21, 2017
@mattab mattab added the answered For when a question was asked and we referred to forum or answered it. label Mar 21, 2017
@dev-101
Copy link
Author

dev-101 commented Mar 21, 2017

Hi mattab,

I looked into the source code of Piwik, and for one, I could not locate where the hack it starts the session?

It does not use session_start() method, for sure. I have located Session class and traced the code from there, but it does not work:

if(!isset($_SESSION)) { $startedCleanly = session_start(); } else { $startedCleanly = true; }

Also, I see that Piwik 'likes' to store it's session files to local folders, instead of general one (defined in php.ini).

Now, I do not understand why is your attitude towards this issue so strict, because, sessions are shared resources in PHP, it is not something that can be taken for granted. If any app could start it's own session (by unique ID), we would not have such a problem. But, that is not the case, so, a reasonable and responsible use should be conducted IMHO.

Thanks,
Regards

@dev-101
Copy link
Author

dev-101 commented Mar 21, 2017

P.S.
I have tried the alternative method with database storage, but for some reason, it did not work.
I have edited config file and added the line per instructions under [General] section, both:

session_save_handler = dbtable

and

session_save_handler = "dbtable"

Do we have to create new table @ piwik's database with particular name and replace generic "dbtable" from above? Because, above line just does not work at all.

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