ini_set('session.save_path', 'custom path');影响会话垃圾清理器? [英] Does ini_set('session.save_path', 'custom path'); effect the session garbage cleaner?

查看:56
本文介绍了ini_set('session.save_path', 'custom path');影响会话垃圾清理器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ini_set('session.save_path', 'custom path'); 是否影响会话垃圾清理器?

Does ini_set('session.save_path', 'custom path'); effect the session garbage cleaner?

当我为会话设置自定义目录时,因为我阅读了各种 php 安全指南,在共享主机上为会话设置自定义目录;可以提高会话安全性.

As I'm setting a custom directory for the sessions, because I've read from various php security guides, that setting a custom directory on shared hosting for sessions; can improve session security.

但问题是我在某处读到过,只有当 session_save_path 是默认值且未修改(即使用自定义目录)时,PHP 才会/处理会话垃圾清理?- 这是真的吗,如果是的话,他们有解决方案吗?

But the problem is I've read somewhere that PHP does/handles the session garbage cleaning only when the session_save_path is the default and not modified (ie. using a custom directory)? - is this true, if so is their a solution for this?.

(考虑到我使用的是共享主机).

(take into consideration I'm using shared hosting).

感谢所有帮助!

推荐答案

垃圾收集器在控制权交给你的脚本之前就启动了,所以当 GC 启动时,php.ini 中设置的 save_path 将生效,不是您要覆盖的路径.

The garbage collector kicks in before control is handed over to your script, so when the GC kicks in, the save_path set in php.ini will be in effect, not the path you're overriding with.

本质上,如果您从脚本中覆盖 save_path,则不能使用默认垃圾收集器.会话文件将存储在覆盖目录中,但 GC 将在以前的目录中查找,该目录中现在没有会话文件.

Essentially, you cannot use the default garbage collector if you override the save_path from within your scripts. The session files will be stored in the override directory, but the GC will look in the previous dir, which would now have no session files in it.

这篇关于ini_set('session.save_path', 'custom path');影响会话垃圾清理器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆