RE: [PHP] session_start

From: Date: Tue, 13 Feb 2001 19:58:48 +0000
Subject: RE: [PHP] session_start
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-136963@lists.php.net to get a copy of this message
Not to be nosey or anything but "usually" session data will always be saved or not. How come one would want to check to see if is was or not. -----Original Message----- From: Ernest E Vogelsinger [mailto:ernest@vogelsinger.at] Sent: Monday, February 24, 2003 7:49 AM To: Mr Percival Cc: php-general@lists.php.net Subject: Re: [PHP] session_start At 13:36 24.02.2003, Mr Percival said: --------------------[snip]-------------------- >So how do I check if the session write failed? > >I thought perhaps > >if(session_id() == ""){ > echo "error"; >} > >but if all session_start does is basically assign a session ID then >session_id will never be empty even when the write fails. --------------------[snip]-------------------- You can't check since session write happens _after_ the execution of your script. You could check if ini_get('session.save_path') is writable, or if you are able to create a temp file with some contents on it, but that won't tell you exactly if session writing will be successful - too many different parameters: - what will the size of your session file be? - after your check, how many session files will be written by other instances until it's your turn? - the complete disk usage may change, since you're in a multi-user multi-session environment... Better: make a check if there's enough space left on the session.save_path, on a regular basis (hint: cron job). Make this job either send you an email, or delete orphaned session files (generate a listing and walk it by last access date). -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#136963) next »