【问题标题】:Session variables seem to expire within the hour会话变量似乎在一小时内到期
【发布时间】:2023-04-07 22:27:01
【问题描述】:

我希望这个问题能让你精神焕发。

我有一个在 google 计算引擎上运行的灯上的 PHP 网站。会话变量似乎在一小时内到期。

我尝试了许多修复方法,例如:

在 htaccess 中添加以下内容

php_value session.gc_maxlifetime "18000" php_value session.cache_expire "18000"

并在php.ini-production中增加session.cache_expire = 18000(修改ini文件后我重启了apache)

但是,这些更改似乎都不起作用,而痛点是,如果客户将订单页面保持打开超过一个小时并回来完成它,那么会话变量会在他们单击以将其带到下一个时过期页面。

任何帮助将不胜感激。提前致谢!

【问题讨论】:

  • php.net/manual/en/…Note: 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.
  • 感谢您的回复。除了 php.ini-production 和 .htaccess 之外,还有其他地方可以在谷歌计算引擎的灯中指定 php_value session.gc_maxlifetime 吗?有什么方法可以找出所有值在灯上的指定位置?
  • 您可以在脚本中通过phpinfo() 进行检查以查看使用了什么。
  • 我不确定你是否理解 Markus 的评论。您需要使用session.save_path 设置自定义目录,不同应用之间不共享。
  • Lamp 上只有 1 个应用程序(也就是这个网站)在运行。目前 session.save_path 设置为默认值。

标签: php google-compute-engine e-commerce session-variables lamp


【解决方案1】:

我认为检查正在使用哪个文件的好方法是使用 phpinfo 函数,然后修改适当的 ini 文件以满足您的要求。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-11-05
    • 2019-08-26
    • 2012-09-19
    • 2014-06-30
    • 2013-03-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多