HTTPS with php session in different page

Links for php scripts

Moderators: gesf, Michalio

Post Reply
nitiphone2021
php-forum Active User
php-forum Active User
Posts: 33
Joined: Fri Jan 08, 2021 8:10 pm

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
khumb

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

I have session_start() in my config.php file and I also have this is it as well ->

Code: Select all

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

Are both pages being loaded over https? This can cause problems depending on your PHP configuration.
Post Reply