Sets user-level session storage functions in PHP.
Questions tagged [session-set-save-handler]
27 questions
                    
                    7
                    
            votes
                
                3 answers
            
        PDO prepare silently fails
I'm experimenting with PHP's session_set_save_handler and I'd like to use a PDO connection to store session data.
I have this function as a callback for write actions:
function _write($id, $data) {
    logger('_WRITE ' . $id . ' ' . $data);
    try…
         
    
    
        Wabbitseason
        
- 5,641
- 9
- 49
- 60
                    4
                    
            votes
                
                1 answer
            
        session_set_save_handler and write on php 5.4.12
I am using session_set_save_handler() to save sessions to a DB.  
After moving from php v.5.3 to v.5.4  the write() function is not called at all; neither when calling the session_write_close() function, nor when the script is terminated (it was…
         
    
    
        Valery Patskevich
        
- 86
- 2
- 7
                    3
                    
            votes
                
                2 answers
            
        custom session_handler broken with php7 (session_set_save_handler)
After updating to PHP7 I have some problems with my applications sessionhandling.
It doesn't seem to be a big problem but PHP throws this error everytime:
[18-Jun-2016 20:49:10 UTC] PHP Warning:  session_decode(): Session is not active. You cannot…
         
    
    
        user2429266
        
- 390
- 1
- 3
- 19
                    2
                    
            votes
                
                0 answers
            
        session_set_save_handler class for database not working
After following some tutorials, I'm using a class for session_set_save_handler and trying to store session data in a mysql database.
I've got my class file included and instantiated with:
$sess = new SessionHandler(); 
and the code for my class…
         
    
    
        clov4r
        
- 21
- 4
                    2
                    
            votes
                
                2 answers
            
        What kind of serialization uses PHP function session_set_save_handler's write function?
I make use of session_set_save_handler(). It works fine. However, sometimes I need to alter user's session data. I simply expected that the session data passed to write function are internally created like this:
serialize($_SESSION);
But they are…
         
    
    
        Frodik
        
- 14,986
- 23
- 90
- 141
                    2
                    
            votes
                
                0 answers
            
        session_set_save_handler gc($maxlifetime) working concept
php.net manual's session_set_save_handler example is file based. I tried to implement it for mysql.
I work with uniserver in windows. My setting for error displaying is development environment.
my issue is I couldn't make garbage collection function…
         
    
    
        Andre Chenier
        
- 1,166
- 2
- 18
- 37
                    2
                    
            votes
                
                0 answers
            
        Implementing db-driven session management in PhP without session_set_save_handler()
I am thinking of implementing database-driven session management in PhP and have read on the session_set_save_handler function to specify the callbacks to be triggered on different session-based events. There is also the option to implement an…
         
    
    
        Sunny
        
- 9,245
- 10
- 49
- 79
                    2
                    
            votes
                
                1 answer
            
        php/mongodb session manager, session_set_save_handler() issue
I am using a PHP session manager class that will handle user sessions in MongoDB, but it's not working,  and I can not for the life of me figure out why.  Session variables set successfully, but will not persist into other pages.  Connectivity with…
         
    
    
        Scott
        
- 103
- 1
- 1
- 10
                    1
                    
            vote
                
                1 answer
            
        Storing session in sql (session_set_save_handler())
So, I am making a login system and the users should be logged in more than 24 min. That's why I decided to store the session in my DB.
I used this function: (I established my own sql's connection -> sqlConnectionConfig.php)
sessions.php file (I…
         
    
    
        szab.kel
        
- 2,356
- 5
- 40
- 74
                    1
                    
            vote
                
                3 answers
            
        PHP: on session death change DB
I am using PHP for a project. I have set the session life to 0 so that when the user closes the browser, the session dies and he/she is logged out. However, I have a status variable in the DB which stores the information telling me if the user is…
         
    
    
        Nandit Tiku
        
- 583
- 3
- 5
                    1
                    
            vote
                
                1 answer
            
        Why i cant set session var in __destruct() method?
I try set session var in __destruct() method. 
Method __destruct() is running, but session var not set. 
While, session in __contruct() or other methods (e.g. test()) working as expected.
public function test()
{
    $_SESSION['MyVarTest'] =…
         
    
    
        Stanislav
        
- 923
- 1
- 11
- 28
                    1
                    
            vote
                
                1 answer
            
        Why is session data lost using session_set_save_handler?
I'm doing a migration of a PHP4 application from an old version of CentOS to a newer version.
I'm using session_set_save_handler and for some reason when the following callback is invoked,
write(string $sessionId, string $data)
the $sessionId is…
         
    
    
        user2457870
        
- 640
- 1
- 10
- 14
                    1
                    
            vote
                
                1 answer
            
        PHP Custom Session Handler
I use session_set_save_handler  in a custom session class to use database storage. I have used database session storage for over a year. This has always worked fine and so has the captcha code that I wrote also almost a year ago. Problem I am having…
        user5262341
                    1
                    
            vote
                
                1 answer
            
        PHP Fatal Error SessionHandlerInterface
I am trying to implement a custom SessionHandler in PHP, that handles to session through a database using transactions.
The problem though, is that I keep getting a fatal errors, about the function being on null.
"Fatal error: Call to a member…
         
    
    
        Berkan
        
- 19
- 6
                    1
                    
            vote
                
                1 answer
            
        session_set_save_handler() w/ session timeout
I currently have a class containing the session_set_saver_handlerit's working fine. However I am wanting to implement a session timeout which is causing more problems than first anticipated. 
As far as I am aware the session lifecycle is as follows;…
         
    
    
        jakehallas
        
- 2,456
- 1
- 18
- 26