0

My web server is giving the following warning and causing site to not work properly. Where as same thing works in local server. Is it possible that something is wrong with the web server (hostgator) that out of nowhere it's giving such warnings , without any change to the code? Earlier it used to work just fine. No warning, no issues. The warning is as follows.

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/username/public_html/website.com/reports/dashboard.php:2) in /home/username/public_html/website.com/reports/include/connect.php on line 2

FreeKrishna
  • 1,833
  • 2
  • 12
  • 21
  • `var_dump(ini_get('display_errors'));` – AbraCadaver May 29 '20 at 18:15
  • @AbraCadaver string(1) "1" Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/username/public_html/website.com/reports/index.php:2) in /home/username/public_html/website.com/reports/include/connect.php on line 2 – FreeKrishna May 29 '20 at 18:21
  • Add `error_reporting(E_ALL);` in the beginning of your code as well. – M. Eriksson May 29 '20 at 18:31
  • Unless there are differences in the code, you have display_errors on for the webserver and off locally, but fix the error. – AbraCadaver May 29 '20 at 18:36
  • @MagnusEriksson same error as mentioned above, no difference. – FreeKrishna May 29 '20 at 18:41
  • @AbraCadaver the display_error is set to off in the hostgator server. Also how come out of nowhere this warning pops up when the code hasn't been changed in more than 6 months, nor the web server is touched. – FreeKrishna May 29 '20 at 18:47
  • I think there's some confusion here. I was talking about having display errors on and error reporting set to E_ALL _locally_ so you can get the same error as you do on hostgator. That would be the first step to actually fix the problem (reproduce the issue locally and fix it). So when I recommend E_ALL, I meant locally, where you said you don't get any errors. On hostgator, display_errors should be 0 (you don't want to show errors on the page in prod) – M. Eriksson May 30 '20 at 11:15
  • @MagnusEriksson my main question is, without any modification to the code on live server, nor the server settings, how did a site working for 8+ months suddenly started showing this warning/error at random? – FreeKrishna May 30 '20 at 15:58
  • We're the wrong people to ask that question. It could be any type of update/upgrade of some software/setting in the server environment. That's a question for your hosting provider. We know _nothing_ about what they may have or haven't done. – M. Eriksson May 31 '20 at 08:42

0 Answers0