here I have a login.php file that starts a session when I'm directed my home page and I check whether or not there is a session it says session doesn't exist. here is the login.php file:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: *");
session_start();
include "connect.php";
if (isset($_POST['email']) && isset($_POST['password'])) {
  $email = $_POST['email'];
  $password = $_POST['password'];
  $sql = "SELECT * FROM user_record WHERE email='$email' and password='$password'";
  $result = mysqli_query($conn, $sql);
  if ($result && mysqli_num_rows($result) == 1) {
    $_SESSION['email'] = $email;
    echo "success";
  } else {
    echo "error";
  }
} else {
  echo "missing_data"; // Indicate that required data is missing
}
?>
and here is the session check file:
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: *");
session_start();
include "connect.php";
if (isset($_POST['email']) && isset($_POST['password'])) {
  $email = $_POST['email'];
  $password = $_POST['password'];
  $sql = "SELECT * FROM user_record WHERE email='$email' and password='$password'";
  $result = mysqli_query($conn, $sql);
  if ($result && mysqli_num_rows($result) == 1) {
    $_SESSION['email'] = $email;
    echo "success";
  } else {
    echo "error";
  }
} else {
  echo "missing_data"; // Indicate that required data is missing
}
?>
I've tried changing the php.ini file. I've tried adding session id before session start
 
    