PHP PEAR Auth会话超时

时间:2009-09-29 19:14:14

标签: php pear session-timeout authentication

这个问题一直让我疯狂。在两个单独的项目中(两者都使用PEAR作为库但是使用完全不同的自定义框架编写)我使用PEAR Auth进行身份验证,使用会话。

登录后,用户将在一小时左右的空闲时间内注销。我没有确切的时间,但它很短。

我尝试了以下但没有成功。所有尝试都将会话延长到一天,只是为了指出这一点。

<?php
// Tried built-in methods to extend the idle time, called after Auth is initialised
$auth->setIdle( 86400 );

// Tried increasing the sesion timeout (before auth is called)
ini_set( 'session.gc_maxlifetime', 86400 );

// Tried increasing the cookie timeout (where the phpsession is held, before auth is called)
session_set_cookie_params( 86400 );

// Tried all of the above
?>

还有其他人有这个问题吗?如果是这样,是否可以延长空闲时间?

我只是准备好去做PEAR并编写我自己的基于cookie的auth类,但我没有时间。

1 个答案:

答案 0 :(得分:2)

到目前为止,我没有遇到过这个问题,但我发现你似乎没有涉及到两个可能的原因:

  1. 除了setIdle()之外,您还可以检查auth类的setExpire()方法。
  2. 可能有其他基于php的应用程序/脚本在同一服务器上运行,使用相同的会话存储目录并且超时较低。根据{{​​3}}

      

    如果不同的脚本有不同   session.gc_maxlifetime的值但是   共享同一个地方存储   会话数据然后脚本与   最低价值将清洁   数据。在这种情况下,请使用此指令   与session.save_path.

    一起