douchi0638 2013-01-23 00:50
浏览 47
已采纳

php会话没有从一个页面转到下一个页面

I've used sessions before on shared hosting and they were very simple. I'm now using Amazon and have linux server with the following configuration in php. The catch is session variables don't carry on from one page to the next:

session

Session Support enabled
Registered save handlers    files user memcached
Registered serializer handlers  php php_binary

Directive   Local Value Master Value
session.auto_start  Off Off
session.bug_compat_42   Off Off
session.bug_compat_warn Off Off
session.cache_expire    180 180
session.cache_limiter   nocache nocache
session.cookie_domain   no value    no value
session.cookie_httponly On  On
session.cookie_lifetime 0   0
session.cookie_path /   /
session.cookie_secure   Off Off
session.entropy_file    no value    no value
session.entropy_length  0   0
session.gc_divisor  1000    1000
session.gc_maxlifetime  604800  604800
session.gc_probability  1   1
session.hash_bits_per_character 5   5
session.hash_function   0   0
session.name    PHPSESSID   PHPSESSID
session.referer_check   no value    no value
session.save_handler    files   files
session.save_path   /var/lib/php/session    /var/lib/php/session
session.serialize_handler   php php
session.use_cookies On  On
session.use_only_cookies    On  On
session.use_trans_sid   0   0

Sample Page: http://www.datingjapan.co/index.php

Code: index.php

<?php
session_start();
error_reporting(E_ALL & ~E_NOTICE);
$_SESSION['domain'] = 'www.datinggirls.co';
print_r($_SESSION);
?>

<h1>This is the HTML</h1>
<a href="page.php">Visit W3Schools</a>

page.php

<?php
session_start();
$_SESSION['page2'] = 'page-two-data';
print_r($_SESSION);
?>

<h1>This is page 2</h2>
<a href="index.php">Visit Home Page</a>

Any advise... ?

thx

  • 写回答

2条回答 默认 最新

  • duanke6249 2013-01-23 00:57
    关注

    Each time I ping your domain www.datingjapan.co it gives me a different IP.

    Is your shared hosting on multiple cloud instances ? Probably.

    Then the PHP session files may be stored localy on the first server that displayed the page "index". When you load the second page, you are on another server...

    I agree with Peter, look at the amazon FAQ or support about how your session storage is synchronized (or not).

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

报告相同问题?

悬赏问题

  • ¥15 求会做聚类,TCN的朋友有偿线上指导。以下是目前遇到的问题
  • ¥100 无网格伽辽金方法研究裂纹扩展的程序
  • ¥15 错误于library(org.Hs.eg.db): 不存在叫‘org.Hs.eg.db’这个名称的程序包,如何解决?
  • ¥60 求一个图片处理程序,要求将图像大小跟现实生活中的大小按比例联系起来的
  • ¥50 求一位精通京东相关开发的专家
  • ¥100 求懂行的大ge给小di解答下!
  • ¥15 pcl运行在qt msvc2019环境运行效率低于visual studio 2019
  • ¥15 MAUI,Zxing扫码,华为手机没反应。可提高悬赏
  • ¥15 python运行报错 ModuleNotFoundError: No module named 'torch'
  • ¥100 华为手机私有App后台保活