有没有办法确定*实际*会话保存路径? [英] Is there any way to determine the *actual* session save path?

查看:38
本文介绍了有没有办法确定*实际*会话保存路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道有六种方法可以获取 session.save_path 指令的值(phpinfo(), session_save_path()等),但当值为空字符串时,默认情况下,实际路径可以是多个位置中的任何一个.我读过它通常是 /tmp,除非它是 /var/lib/php5,但在 OS X Mountain Lion 上它绝对是 /private/var/tmp.在 Windows 上,它可能是 C:\Windows\Temp,但谁知道呢.

I know there are half a dozen ways to get the value of the session.save_path directive (phpinfo(), session_save_path(), etc.), but when the value is an empty string, as it is by default, the actual path can be any of several locations. I've read that it's usually /tmp, except when it's /var/lib/php5, but on OS X Mountain Lion it's definitely /private/var/tmp. On Windows, it's probably C:\Windows\Temp, but who knows.

我可以指定位置,但这对我没有帮助.我正在尝试诊断一个棘手的问题,我想知道我没有完全访问权限的服务器上的当前位置.如果有正确的方法来做到这一点,我还没有找到.我对聪明的黑客持开放态度.

I could specify the location, but that won't really help me. I'm trying to diagnose a tricky problem and I would like to know what the current location is on a server that I don't have full access to. If there's a right way to do it, I haven't been able to find it. I'm open to clever hacks.

推荐答案

我还没有查看 PHP 源代码来确认这一点,但是看起来当 session.save_path 为空时,PHP 使用sys_get_temp_dir() 的值(因用户而异).

I have not reviewed the PHP source code to confirm this, but it looks like when session.save_path is empty, PHP uses the value of sys_get_temp_dir() (which varies by user).

这篇关于有没有办法确定*实际*会话保存路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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