dreamfly2016 2011-07-10 22:04
浏览 34
已采纳

PHP:会话文件不包含任何数据

I've looked around on the internet, including stack overflow, for a few days trying to resolve my issue with PHP sessions. For one, I've noticed that most of the tutorials simply say "Here's the code, go use it." and not so much "This is how it works." Additionally, all of the issues/answers I find seem to be about information being lost on refresh or after switching pages and none of these apply to me.

The data in $_SESSION is being stored/loaded no matter which page I view. My issue is, when I view the session files on the server, there is no data in them. Additionally, when I destroy a session or unset the variables the information is still stored and the next time $_SESSION is accessed the old information is retrieved.

To troubleshoot the behavior of sessions on my server I created an extremely simple script:

<?php
// Use $HTTP_SESSION_VARS with PHP 4.0.6 or less
if (!isset($_SESSION['count'])) {
  $_SESSION['count'] = 0;
} else {
  $_SESSION['count']++;
}

echo $_SESSION['count'];
?>

This is ALL of the code on the page (viewable here: ). Every time this page is refreshed a new, blank, session file is saved into the specified directory on the server and the counter does not increase.

More information:
For information regarding php install:
Hosted on GoDaddy Shared Hosting - Linux OS
I will update the permissions on the phpsessions directory to be temporarily browseable shortly. ()

  • 写回答

3条回答 默认 最新

  • dougeqiang1619 2013-12-08 10:38
    关注

    UPDATE: I haven't been to stack overflow in a while and decided to look back at this question because it was 1 of the only 2 I asked. I'd like to mention that the issue was that the php session name was changed and needed to be changed back to the default.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 软件测试决策法疑问求解答
  • ¥15 win11 23H2删除推荐的项目,支持注册表等
  • ¥15 matlab 用yalmip搭建模型,cplex求解,线性化处理的方法
  • ¥15 qt6.6.3 基于百度云的语音识别 不会改
  • ¥15 关于#目标检测#的问题:大概就是类似后台自动检测某下架商品的库存,在他监测到该商品上架并且可以购买的瞬间点击立即购买下单
  • ¥15 神经网络怎么把隐含层变量融合到损失函数中?
  • ¥15 lingo18勾选global solver求解使用的算法
  • ¥15 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥20 测距传感器数据手册i2c