backend.php file : where following session variables are being set
$_SESSION['user_id'] = $user_id;
$_SESSION['user_email'] = $user_email;
Next : As I can verify in the directory /var/cpanel/php/sessions/ea-php74 the session files are getting created. After this the session suppose to be read and understood by the website frontend index.php file and for that below is the index.php code
session_start();
if(isset($_SESSION['user_email'])){
update session variable e.g.,
$user_email = $_SESSION['user_email'];
}else{
echo "session not set";
}
but somehow the session_start() or if(isset($_SESSION[‘user_email’])) is not functioning hence the flow always go to else condition and it ends with "session not set"
Note: The php.ini file contains session.save_path = "/var/cpanel/php/sessions/ea-php74"
Please suggest!
2
Answers
Test session id
And
Detect if PHP session exists
you must have to start session before setting initial value for session e.g:
and then you can read or edit session values: