PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, January 25, 2022

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

 January 25, 2022     mysql, php, phpmyadmin     No comments   

Issue

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.


Solution

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



Answered By - Xenonite
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing