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 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!

Daniel
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]

The first CMS Builder reference book is now available on-line!







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,

Daniel
Technical Lead
interactivetools.com

By gkornbluth - June 7, 2019

Sure!

That's very generous!

Thanks,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







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

The first CMS Builder reference book is now available on-line!







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,

Daniel
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

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php