$_SESSION variable error in second php file

I have reduced the code in both files to try and figure out what is going on.

In my first file loginuser.php, I am running the following lines:

<?php
session_start();

$_SESSION['user_id'] = "test";

// more code follows; nothing else that involved user id or session

To double check that $_SESSION variable is indeed set, I ran the following modified approach:

<?php
session_start();

$_SESSION['user_id'] = "test";

$response['success'] = false;
$response['message'] = $_SESSION['user_id'];

echo json_encode($response);
exit;

When $response[‘success’] is false, the message is printed. So at this point I know that the $_SESSION variable was indeed set and I am getting a body response.

In my second file addrelease.php, I then run the following lines to check if I am seeing the session variable even before I do anything else:

<?php
session_start();

$response['message'] = $_SESSION['user_id'];

// more code would follow but again i will force message to pop and exit
$response['success'] = false;
echo json_encode($response);
exit;

The app will toast “Error, no response” if there is no body provided in the response (I am using retrofit) and this is exactly what happens. Given this, I know that addrelease.php does not even echo the response.

To confirm my suspicion that something is going on with the $_SESSION variable, I replaced $_SESSION[‘user_id’] in addrelease.php with “test2” and now I am getting a body with the message that I forced.

Most posts that I am finding seem to resolve their issue by ensuring the session_start() is the very first thing that is called and doubling checking the session_save_path. I have looked at both of these and can’t find any issues.

Hoping someone can help me, thanks in advance!

P.S. this is all new to me so please excuse if I am making a very basic mistake somewhere.