Jump to content

No files in assets/sessions directory


Doc
 Share

Recommended Posts

Hi,

I don't see any files in assets/sessions directory. Both are in chmod 755.

Previously I was running with sessions in DB but it seems the DB can't handle the load on my shared hosting (too many restart...).

So I'm disabling the sessions in DB.

I can login in my website but I don't see any files on my host ? Perhaps PW handles that in local only, on my browser...

Before I set up the sessions in DB my users were complaining because the sessions were too short.

This is what I have in my config.php :

$config->sessionExpireSeconds = 4320000; // 50 days
ini_set('session.cookie_lifetime', 4320000);    
//$config->sessionExpireSeconds = 432000; 
ini_set("session.gc_probability", 1);
ini_set("session.gc_divisor", 100);

Any ideas ?

Thanks

Link to comment
Share on other sites

There are many on this forum who would like to help you.  Could you provide some additional information regarding your ProcessWire installation, third-party modules installed and any other special setups/configurations you may have made?

  • Like 1
Link to comment
Share on other sites

Hi @cstevensjr,

Sure : 

I'm using PW 3.0x, No fancy module : CK Editor and multilanguage stuff.

I've just discovered that sessions files are created on my laptop (mac) but when it's uploaded, sessions directory stays empty.

That said I cannot see any differences in the config, but I'm still looking (there must be some differences...).

Directories permissions are the same on site, assets, and sessions.

I've just read again the security/permissions sections but no more clue right now.

Thanks

Link to comment
Share on other sites

Hi szabesz,

Good idea : 

I read "/tmp"...

So what does that mean ? Perhaps I can modify that and store them on site/assets/sessions ?

The problem is, wherever it's stored today, it doesn't live long enough, and users complain (gently).

The problem was "solved" with database sessions, which lived long enough, but the db was hit too much.

 

  • Like 1
Link to comment
Share on other sites

As far as I can see, it is set in Session.php:

https://github.com/processwire/processwire/blob/master/wire/core/Session.php#L263

...
if(ini_get('session.save_handler') == 'files') {
	if(ini_get('session.gc_probability') == 0) {
		// Some debian distros replace PHP's gc without fully implementing it,
		// which results in broken garbage collection if the save_path is set. 
		// As a result, we avoid setting the save_path when this is detected. 
	} else {
		ini_set("session.save_path", rtrim($this->config->paths->sessions, '/'));
	}
}

@session_start();
...

So I guess it is possible to set it in config.php with $config->paths->sessions, see

I tried it with absolute path and it works for me, e.g.:

$config->paths->sessions = "/Users/user/MAMP/siteroot/site/assets/mysessions";

I think "/tmp" can be the system default which gets purged so that is why you have issues with it. But I'm just guessing, I'm not a Linux admin kind :) 

  • Like 3
Link to comment
Share on other sites

Ok, still stuck to /tmp but I think it's a good idea to look in this area.

I've checked my dev phpinfo() and it show the sessions in the assets/sessions directory (for local value, master value still in /Applications/MAMP/tmp/php).

So my goal is to change that value (local) in my prod setup.

to be followed !

thanks

Update : My host doesn't authorize me to make any changes in that location, so I'm stuck with DB sessions for now. I'm studying some other hosts.

Thanks for helping me !

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...