ochi Posted February 2, 2010 Share Posted February 2, 2010 hello, I cant delete session variables with the configuration in php.ini, this is my configuration (I'm sorry, I dont know how to attach images): Directive Local Value Master Value session.auto_start Off Off session.bug_compat_42 On On session.bug_compat_warn On On session.cache_expire 180 180 session.cache_limiter nocache nocache session.cookie_domain no value no value session.cookie_httponly Off Off session.cookie_lifetime 0 0 session.cookie_path / / session.cookie_secure Off Off session.entropy_file no value no value session.entropy_length 0 0 session.gc_divisor 1 1 session.gc_maxlifetime 60 60 session.gc_probability 1 1 session.hash_bits_per_character 4 4 session.hash_function 0 0 session.name PHPSESSID PHPSESSID session.referer_check no value no value session.save_handler files files session.save_path /var/lib/php5 /var/lib/php5 session.serialize_handler php php session.use_cookies On On session.use_only_cookies Off Off session.use_trans_sid 0 0 This is what I see when I use phpinfo(). I thougth that after 60 seconds the SESSION variables will be consider as garbage, and the probability of delete the garbage is the 100%, but I have something wrong because the sentence: if(isset($_SESSION['whatever'])) Is always true. Another thing, is there any posibility of remove them when the tab is closed? I remove them when the browser (and the tab) are closed. Thank you! Regards Link to comment https://forums.phpfreaks.com/topic/190628-phpini-delete-session/ Share on other sites More sharing options...
trq Posted February 2, 2010 Share Posted February 2, 2010 If your on a shared host you might want to move your session.save_path to somewhere under your control as per the manual: If different scripts have different values of session.gc_maxlifetime but share the same place for storing the session data then the script with the minimum value will be cleaning the data. In this case, use this directive together with session.save_path. Another thing, is there any posibility of remove them when the tab is closed? No. Link to comment https://forums.phpfreaks.com/topic/190628-phpini-delete-session/#findComment-1005351 Share on other sites More sharing options...
ochi Posted February 2, 2010 Author Share Posted February 2, 2010 I'm trying to do it with date and calculing myself the different of time, using date function, is there any advantage to do it with php.ini, because if not, I'm going to forget this option... Thanks! Link to comment https://forums.phpfreaks.com/topic/190628-phpini-delete-session/#findComment-1005356 Share on other sites More sharing options...
trq Posted February 2, 2010 Share Posted February 2, 2010 Manually keeping track of sessions will likely lead to problems. You could manually create a cronjob to do it, but that makes things a little less configurable. PHP actually uses cron itself, just reads your config options into the picture. thorpe@oblivion $ cat /etc/cron.d/php5 # /etc/cron.d/php5: crontab fragment for php5 # This purges session files older than X, where X is defined in seconds # as the largest value of session.gc_maxlifetime from all your php.ini # files, or 24 minutes if not defined. See /usr/lib/php5/maxlifetime # Look for and purge old sessions every 30 minutes 09,39 * * * * root [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -n 200 -r -0 rm Link to comment https://forums.phpfreaks.com/topic/190628-phpini-delete-session/#findComment-1005357 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.