Jump to content

session.save_path not set


mr_mind

Recommended Posts

Alright i dont know if this is correct but i have a function that i am implementing to read the session files and see who is online. The problem is "session_save_path()" returns null. I checked in the php.ini and it is remarked out, but the sessions work fine. What i think i need to do is find the default session save path and specify that in the php.ini and then try the function. if not just specify the absolute path in the function instead of using session_save_path(). My question is, what is the default session save path for php 5?

Link to comment
https://forums.phpfreaks.com/topic/81203-sessionsave_path-not-set/
Share on other sites

alright well i fixed the problem of the session path not being set but now my function returns 0 users online all the time. Here it is:

 

<?php
function users_online() {
	if(is_dir(session_save_path())) {
		$users_online_max_time = 3;
		$users_online_handle = session_save_path();
		$users_online_count = 0;
		$users_online_files = glob($users_online_handle . "*");
		foreach($users_online_files as $users_online_file) {
			if($users_online_file != '.') {
				if($users_online_file != '..') {
					$script_time = time();
					$file_time = fileatime($users_online_file);
					if(($script_time - $file_time) < $users_online_max_time * 60) {
						$users_online_count++;
					}
				}
			}
		}
		return $users_online_count;
	}
	else {
		return session_save_path();
	}
}
print 'Online Users: ' . users_online(); 
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.