Fatal error: setPrefixedCookie: Can't set cookie(loginsession,

3 posts by 2 authors in: Forums > CMS Builder
Last Post: May 24, 2018   (RSS)

By gregThomas - May 24, 2018

Hey Maurice,

This error happens when the server attempts to set a cookie, but the page has already started loading, so the headers have already been sent and a new one cannot be added. 

There are a few different solutions to this:

1) Ensure that the first thing that happens on the front end of the site is that the viewer_functions.php file is loaded, and no HTML or other white space is displayed first. This will ensure the headers can be set by the CMS.

2) On the front end of the site, make the ob_start() function the first thing that is called on each page. This will buffer any content that appears on the page and display it once all of the PHP code has been executed, ensuring any headers that are part way through the code can be added.

3) Enable output buffering on the server, this has the same behaviour as ob_start() and will buffer any code that needs outputting until the entire page has loaded allowing headers to be set in the background. You can read about implementing this here: http://php.net/manual/en/outcontrol.configuration.php

I found this great StackOverflow post on the issue here: 

https://stackoverflow.com/a/8028987

Cheers,

Greg

Greg Thomas







PHP Programmer - interactivetools.com

By Maurice - May 24, 2018

Heeee Greg,

SUPER THNX going to try it right away.

again THNX

Maurice

-------------------------------------------

Dropmonkey.nl