HTTPS with php session in different page

nitiphone2021

New member
Hi friends.
I have a problem with https about $_SESSION in php
last time my website is working correctly with http but after change to https I can send value of session to another page

login.php
session_start();
$_SESSION['user_ID'] = 8;

Action.php
session_start();
echo "User ID = " . $_SESSION['user_ID'] ; //// It's not show any thing

Thank you very much for your help
 
Hi All, I have the same problem after upgrading the PHP server to 7.4.1.4, once i redirect to another page with "header function"....the $_SESSION is not set anymore. Even though all my affected pages start with "session_start(); at the top. Please help.
 
I have session_start() in my config.php file and I also have this is it as well ->

Code:
if($_SERVER["HTTPS"] != "on")
{
    header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
    exit();
}

I am also running version PHP 8 and haven had any problems.
 
Are both pages being loaded over https? This can cause problems depending on your PHP configuration.
 
Back
Top