Zend_Session please help! framework 1.1.17 + PHP5.3 + MySQL

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Zend_Session please help! framework 1.1.17 + PHP5.3 + MySQL

AsIaNSeXyNinE ( Phicheth Kijtaow )
I can use Zend_Session with Zend_Session_SaveHandler_DbTable on my
webapp NO error or warning message .. but I don't really know .. what
doing anything wrong with a session config? Session expired won't from
Session_DB_Table..

Zend framework 1.1.17 + PHP5.3 + MySQL 5 on Apache 2.2
my setting :

    Zend_Session::setOptions(array(
    'save_path' => GSESSDC,  // GSESSDC is my define save_path
    'cache_expire' => '1',        // Cache expire every one minute
    'gc_maxlifetime' => '120', // set maxlifetime = 120 seconds
    ));

    Zend_Db_Table_Abstract::setDefaultAdapter($db);
    $SessConfig = array(
        'name'           => 'session',
        'primary'        => 'id',
        'modifiedColumn' => 'modified',
        'dataColumn'     => 'data',
        'lifetimeColumn' => 'lifetime'
    );

    //create your Zend_Session_SaveHandler_DbTable and
    //set the save handler for Zend_Session
    Zend_Session::setSaveHandler(new
Zend_Session_SaveHandler_DbTable($SessConfig));

    //start your session!
    Zend_Session::start();


------------------------------------------

I am not found any Error or Warning message.. Session was create on my
database as well.. try with different web browser are working with
create and update session into database table.. No problem about
this..

But what is a problem now? When a session was expired I am setting
'gc_maxlifetime' => '120' that mean .. if not session not active over
2 minutes must been deleted from session table automatic .. I was try
to create new session via different web browser and let session
expired to make sure that my session DB working.. but often refresh
page ... but expired session still show in my session database as
well..

Any easy idea to deleted expired session from Zend_Session DB? or need
to run cronjob? how to make a Cronjob to deleted expired session in
database? need to run cache? how to do it , please help..

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Zend_Session please help! framework 1.1.17 + PHP5.3 + MySQL

weierophinney
Administrator
-- AsIaNSeXyNinE ( Phicheth Kijtaow ) <[hidden email]> wrote
(on Thursday, 16 June 2011, 05:53 AM -0700):
> I can use Zend_Session with Zend_Session_SaveHandler_DbTable on my
> webapp NO error or warning message .. but I don't really know .. what
> doing anything wrong with a session config? Session expired won't from
> Session_DB_Table..

While PHP will periodically garbage collect expired sessions, it's not
reliable. I'd have a cronjob do it.

> Zend framework 1.1.17 + PHP5.3 + MySQL 5 on Apache 2.2
> my setting :
>
>     Zend_Session::setOptions(array(
>     'save_path' => GSESSDC,  // GSESSDC is my define save_path
>     'cache_expire' => '1',        // Cache expire every one minute
>     'gc_maxlifetime' => '120', // set maxlifetime = 120 seconds
>     ));
>
>     Zend_Db_Table_Abstract::setDefaultAdapter($db);
>     $SessConfig = array(
>         'name'           => 'session',
>         'primary'        => 'id',
>         'modifiedColumn' => 'modified',
>         'dataColumn'     => 'data',
>         'lifetimeColumn' => 'lifetime'
>     );
>
>     //create your Zend_Session_SaveHandler_DbTable and
>     //set the save handler for Zend_Session
>     Zend_Session::setSaveHandler(new
> Zend_Session_SaveHandler_DbTable($SessConfig));
>
>     //start your session!
>     Zend_Session::start();
>
>
> ------------------------------------------
>
> I am not found any Error or Warning message.. Session was create on my
> database as well.. try with different web browser are working with
> create and update session into database table.. No problem about
> this..
>
> But what is a problem now? When a session was expired I am setting
> 'gc_maxlifetime' => '120' that mean .. if not session not active over
> 2 minutes must been deleted from session table automatic .. I was try
> to create new session via different web browser and let session
> expired to make sure that my session DB working.. but often refresh
> page ... but expired session still show in my session database as
> well..
>
> Any easy idea to deleted expired session from Zend_Session DB? or need
> to run cronjob? how to make a Cronjob to deleted expired session in
> database? need to run cache? how to do it , please help..
>
> --
> List: [hidden email]
> Info: http://framework.zend.com/archives
> Unsubscribe: [hidden email]
>
>

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc

--
List: [hidden email]
Info: http://framework.zend.com/archives
Unsubscribe: [hidden email]