Mattis Asp
Mattis Asp

Reputation: 1003

Cannot start session without errors in phpMyAdmin, session variables don't work

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.

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) 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';
?>

My php.ini file:

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

Permissions:

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

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

Upvotes: 2

Views: 10428

Answers (1)

Xenonite
Xenonite

Reputation: 1965

I agree with bansi:

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.

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

Upvotes: 3

Related Questions