dongxun6458
2012-05-03 06:46
浏览 59
已采纳

会话未携带到https服务器php中的另一个页面

I developed one site with session. Its works in Local server and Also in Production machine. Now they move the site to new server with SSL HTTPs . Here i face one problem .

Session set in one page but not carry over to another page. Same code works in http based server.

I tried the following methods to resolve this but not yet it solved

1) I pass the session id over url and set in another page. Here also SESSION not set.

2) I use this two lines in my php file as some one suggested in some forums

ini_set("display_errors",1); error_reporting(E_ALL);

3) I also use these lines also to resolve as some one suggested in some forums ini_set('session.cookie_domain', 'https://xxx.com');

session_set_cookie_params(ini_get('session.cookie_lifetime'), ini_get('session.cookie_path'), 'https://xxx.com');

4)In PHP.ini, follwing things under session is shown

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 Off Off

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 1440 1440

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 Off Off

session.use_trans_sid 0 0

Following Error Message shown in server Undefined index: userid in /var/www/vhosts/xxx.com/httpdocs/HomePage.php on line 9

Still I have same problem. Please suggest me to resolve this problem

Thanks in advance

图片转代码服务由CSDN问答提供 功能建议

我用会话开发了一个站点。 它适用于本地服务器和生产机器。 现在,他们使用SSL HTTP将站点移动到新服务器。 在这里,我面临一个问题。

会话设置在一个页面中,但不会转移到另一个页面。 相同的代码适用于基于http的服务器。

我尝试了以下方法来解决这个问题但尚未解决

1)我将会话ID传递给url并设置在另一个页面中。 这里也没有设置SESSION。

2)我在我的php文件中使用这两行,就像在某些论坛中建议的那样

ini_set(“display_errors”,1); \ nerror_reporting(E_ALL);

3)我也使用这些行来解析某些论坛中的建议 ini_set('session.cookie_domain','https://xxx.com “);

session_set_cookie_params(ini_get('session.cookie_lifetime'),ini_get('session.cookie_path'),'https://xxx.com');

4)在PHP.ini中,显示会话中的以下内容

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 Off Off

session.cookie_lifetime 0 0

session.cookie_path / /

nn

session.cookie_secure Off Off

session.entropy_file没有值没有值

session.entropy_length 0 0

session.gc_divisor 1000 1000

session.gc_maxlifetime 1440 1440

session.gc_probability 1 1

session.hash_bits_per_character 5 5

session.hash_function 0 0

session.name PHPSESSID PHPSESSID

session.refe rer_check no value no value

session.save_handler文件文件

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 Off Off < /p> nn

session.use_trans_sid 0 0

服务器中显示的错误消息 未定义的索引:/var/www/vhosts/xxx.com/httpdocs中的userid 第9行/HomePage.php

我仍有同样的问题。 建议我解决这个问题

提前致谢

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dtf579777 2012-05-21 12:26
    已采纳

    Here They give Vhost server. Vhost server doesn's store sessions. So only only i face this problem.. I use oneway to resolve this problem. Pass session as POST variable and assign the session id in each page. Now it works..

    点赞 打赏 评论
  • douhu4091 2012-05-03 09:09

    You've given some information about changes you've made to afect the outcome, but you've not provided any details of the diagnostics you've done to identify the problem.

    Have you chacked that the browser is returning the session cookie? Have you checked that a session file exists? Does the session span http and https? If so, do the vhosts run under different uids?

    <?php
    
    print_r($_COOKIE);
    
    if ($_COOKIE[sesion_name()]) {
        $path=ini_get('session.save_path') . '/' . $_COOKIE[sesion_name()];
        if (!is_readable(dirname($path)) || !is_dir(dirname($path))) {
          print "bad session dir
    ";
        }
        if (!is_readable($path) || !is_file($path)) {
          print "bad session file
    ";
        } else if (!is_writeable($path)) {
          print "permissions issue with session file
    ";
        }
        print_r(stat($path));
        print "
    
    ";
        print @file_get_contents($path);
    } else {
        print "no session cookie";
    }
    
    点赞 打赏 评论

相关推荐 更多相似问题