I'm completely stumped by this and looking for a fresh set of eyes.
I've two servers that are identical in every way except that our qual server is on http and our prod server is on https - otherwise they are clones of one another in every way (xampp, mysql, php version etc...)
On qual, the user loads (for sake of simplicity) a.php
, which has these relevant lines:
<?php
session_start();
include('b.php');
?>
then b.php starts:
<?php
session_start();
include('c.php');
?>
and c.php starts:
<?php
session_start();
?>
In development, this has been working perfectly - but after pushing all of our code up and pulling the exact same code down onto the production server (brand new test folder), we now get these errors in prod:
Warning: session_start(): cannot send session cache limiter - headers already sent by... (b.php and c.php)
and
Warning: session_start(): Cannot send session cookie - headers already sent by (b.php and c.php)
I understand what the text is saying - but what irks me is that I cannot find a method to make this code work simultaneously on two servers which are exactly the same!
On QUAL:
If I remove the calls to session_start()
from b.php and c.php - the application, calls to $_SESSION variables within those pages fail to return valid data - but if I include the statement in each file, everything is peachy.
On PROD:
If I remove the calls to session_start()
, everything works perfectly, and the $_SESSION variables in b.php and c.php load just fine, but if I include session_start(); I get the errors above.
I cannot, for the life of me, figure out what is causing this and I cannot remove https from production in order to test this (since it is truly the only difference between the two servers).
I'm positive the code is exactly the same as well - same git commit, everything.
Any ideas on what could be causing this variance? I'm really stumped!