Can't get rid of "Can't set cookie(loginsession" errors
8 posts by 2 authors in: Forums > CMS Builder
Last Post: June 11, 2019 (RSS)
By gkornbluth - June 5, 2019
Hi All,
I’ve moved to a new server running PHP 7.0 and have re-set up a number of CMSB 3.50 sites on the new server without issues, but despite following all the suggestions in post 2243199, I’m getting the following fatal errors when I try to access the CMSB pages on this one site. (page file name changes depending on the page I’m trying to access)
#109 - E_USER_ERROR: setPrefixedCookie: Can't set cookie(loginsession, =0HNygDN2cTO1UTM6IyczV2YjFEdzFGbiwiImJWYhBTYklDOwIjMhFDN1UjZ1Y2MhF2N0ADOxETO0IWMhdDZwMzY0QSMhh2ckIiOig2chhEZy92dzNXYwJCLigGd1xmYuJ3brdmI6ISZtFmbyV2c1Jye), headers already sent! Output started in /home2/ngpymrmy/public_html/pollick/OK/gallery.php line 1.
/home2/ngpymrmy/public_html/pollick/cmsAdmin/lib/common.php (line 742)
http://www.pollick.net/OK/gallery.php
I've also tried Dave Edis’ suggestion about the PHP "output_buffering" setting and an .htaccess file using - php_value output_buffering 4096 - but all I get is a 500 error
The code generator code for the viewers seem to work, so I’ve rebuilt all of the pages to match as close as I was able, but still no joy. (The code up to the <!DOCTYPE html> tag is identical on both the generated pages and my pages but my pages still throw the error)
I clear the cache between tests and tried other browsers but it hasn't helped
I’ve attached a copy of both a generated code viewer and the associated viewer that doesn’t work.
Hope someone can spot a critical difference that I’ve missed.
Thanks,
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
By daniel - June 7, 2019
Hey Jerry,
I'm not able to see a specific difference between the two files that would be causing the issue, but the general implication of that error message is that there's some sort of output happening before a cookie being saved. This often happens due to unnecessary whitespace (spaces, tabs, newlines, blank lines, etc.) as it can be easy to overlook, so my first recommendation would be to make sure that there's no whitespace above and among the PHP code at the top of the page. To be doubly sure, you can remove places where closing and opening PHP tags are separated by a newline, such as turning this:
<?php header('Content-type: text/html; charset=utf-8'); ?>
<?php
/* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
To this:
<?php header('Content-type: text/html; charset=utf-8');
/* STEP 1: LOAD RECORDS - Copy this PHP code block near the TOP of your page */
If that doesn't help, can you check the Developer Log in CMSB and copy the "Backtrace" field from this error for me to look at?
Thanks!
Technical Lead
interactivetools.com
By gkornbluth - June 7, 2019
Hi Daniel,
Thanks for taking the time to respond to this.
Sorry, but that didn't seem to fix the issue.
Here's the backtrace. Hope it sheds some light...
Jerry Kornbluth
#0 _errorlog_logErrorRecord() called at [/home2/ngpymrmy/public_html/pollick/cmsAdmin/lib/errorlog_functions.php:64]
#1 _errorlog_catchRuntimeErrors() called
#2 trigger_error() called at [/home2/ngpymrmy/public_html/pollick/cmsAdmin/lib/common.php:742]
#3 setPrefixedCookie() called at [/home2/ngpymrmy/public_html/pollick/cmsAdmin/lib/login_functions.php:337]
#4 loginCookie_set() called at [/home2/ngpymrmy/public_html/pollick/cmsAdmin/lib/login_functions.php:66]
#5 getCurrentUser() called at [/home2/ngpymrmy/public_html/pollick/cmsAdmin/plugins/websiteMembership1.13/websiteMembership.php:111]
#6 _websiteLogin_getCurrentUser() called at [/home2/ngpymrmy/public_html/pollick/cmsAdmin/plugins/websiteMembership1.13/websiteMembership.php:58]
#7 _websiteLogin_init() called at [/home2/ngpymrmy/public_html/pollick/cmsAdmin/lib/plugin_functions.php:312]
#8 doAction() called at [/home2/ngpymrmy/public_html/pollick/cmsAdmin/lib/viewer_functions.php:19]
#9 include_once() called at [/home2/ngpymrmy/public_html/pollick/OK/gallery.php:6]
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
By daniel - June 7, 2019
Hey Jerry,
Thanks for providing the backtrace. Unfortunately, it doesn't show me anything conclusive - are you able to submit a 2nd Level Support Ticket with the site's FTP credentials for me to have a look directly? https://www.interactivetools.com/support/request/
Thanks,
Technical Lead
interactivetools.com
By gkornbluth - June 7, 2019
Sure!
That's very generous!
Thanks,
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
By gkornbluth - June 7, 2019
Hi Daniel,
The support request is sent.
As I said in the support ticket, if this turns out to be a big deal, please bill me for the time it takes,
Thanks again, (as always)
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
By daniel - June 11, 2019
Hi all,
I just wanted to follow up with the solution here for anyone who comes across the same issue: There was some sort of unrecognized character at the beginning of the files that wasn't being rendered by text editors. This can sometimes happen when copying from rich text or due to encoding changes, though it's unclear exactly where it came from in this case. As it was at the beginning of the file, this made it nearly impossible to delete. It may be possible to find an editor that will show the character and be able to delete it (I had luck with the built-in text editor in CuteFTP 8.3 Pro), but likely the best solution is to simply create a new file and copy the code over. If your editor can't delete the character, it also shouldn't be able to copy it.
Cheers,
Technical Lead
interactivetools.com
By gkornbluth - June 11, 2019
Oops, sorry,
I should have posted the solution myself, but things have been a bit hectic lately.
Thanks for following up.
Jerry Kornbluth
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php