无法启动会话,而不会在phpMyAdmin中出错,会话变量不起作用 [英] Cannot start session without errors in phpMyAdmin, session variables don't work

查看:60
本文介绍了无法启动会话,而不会在phpMyAdmin中出错,会话变量不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,我已经看过rciiipo从2011年开始的帖子我的问题似乎无法通过提供的答案解决,我还有其他一些输入.

First, I have already looked at rciiipo's post from 2011. My problem don't seem to be fixed with the answers provided, and I have a few other inputs.

将浏览器指向phpMyAdmin时出现以下错误

I get the below error when pointing browser to phpMyAdmin

Cannot start session without errors, please check errors given in 
your PHP and/or webserver log file and configure your PHP installation properly.
Also ensure that cookies are enabled in your browser.

1)会话变量不适用于任何php文件.我不太确定是否与之相关,但我相信一个问题会导致另一个问题.

1) Session variables don't work with any php file. I am little unsure if it is related, but i believe the one problem causes the other.

当我刷新网页时,以下代码应显示泰迪":

This code below should display "teddy" when i refresh the webpage:

<?php
session_start();

$username = $_SESSION['username'];
if(isset($_SESSION['logged']) && $_SESSION['logged']=='yes') {
    echo "$username";
}   

$_SESSION['username']='Teddy';
$_SESSION['logged']='yes';
?>

我的php.ini文件:

My php.ini file:

session.save_path = "/var/lib/php5/session"

权限:

drwxr-xr-t  4 root www-data 4096 Sep  1 08:40 php5
  |
  -- drwxr-xr-x  2 root www-data 4096 Sep  1 08:40 session

我认为,只要让$ _SESSION变量在php中工作,问题就可以解决.

I think the problem can be fixed if I only get $_SESSION variables to work in php.

推荐答案

我同意 bansi :

您似乎对/var/lib/php5/session拥有错误的权限 应该是drwxrwxr-t或dr-xrwxr-t(假设www-data是网络 服务器用户).必须具有目录中的写许可权才能保存 会话数据.

it looks like you have wrong permission for /var/lib/php5/session it should be drwxrwxr-t or dr-xrwxr-t (assuming www-data is the web server user). Write permission is required in the directory to save session data.

此外,您应该检查PHP/var/log/中的日志文件(也许还有Apache)-它们可能会为您提供更多详细信息...

Also, you should check the log files in /var/log/ of PHP (and maybe Apache as well) - they might give you some more details...

这篇关于无法启动会话,而不会在phpMyAdmin中出错,会话变量不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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