I want to run a Cron job for php File that should run after 30 minutes. But My File has a session varibale And cron job is not working

Here i have a connection in my config file. and when i run this file after login, All queries are working properly but when i added into this in cronjob then this script is not working.
this is my cron job url.

/usr/local/bin/php /home/wi095p7714d0/public_html/fenc/cron.php
<?php
session_start();
session_regenerate_id(true);
include('../includes/config.php');

if(!isset($_SESSION['login_id'])){
    header('Location: login.php');
    exit;
}

$id = $_SESSION['login_id'];
$intiatlamount=0;
$get_user = mysqli_query($conn, "SELECT * FROM `users` WHERE `email`='$id'");
$getuserid=mysqli_fetch_array($get_user);
$userid=$getuserid['id'];

$wallet= mysqli_query($conn, "SELECT * FROM `wallet` WHERE `uid`='$userid'");
$getwalletbalance=mysqli_fetch_array($wallet);
$walletid=$getwalletbalance['id'];
$walletbalance=$getwalletbalance['balance'];

$spent=mysqli_query($conn, "SELECT * FROM `spent` WHERE `wid`='$walletid'");
if(mysqli_num_rows($spent)< 1){
    $insertspent=mysqli_query($conn, "INSERT into spent (wid,amount)VALUES('$walletid','$intiatlamount')");
}else{
   $getspentq=mysqli_query($conn, "SELECT * FROM `spent` WHERE `wid`='$walletid'");
   $getspent=mysqli_fetch_array($getspentq);
   $spentvalue=$getspent['amount'];
   $newspent=$spentvalue + 1;
   $finalwalletbalance=$walletbalance-$newspent;
   $updatespent=mysqli_query($conn,"UPDATE spent SET amount='$newspent' WHERE wid='$walletid'");
   $updatewallet=mysqli_query($conn,"UPDATE wallet SET balance='$finalwalletbalance' WHERE uid='$userid'");
}
?>