Fork me on GitHub

Try this to solve Header issues with setcookie  Bottom

  • I am using pnForum and was getting a warning similar to this:

    WARNING: Cannot modify headers: Headers have already been sent

    the lines of code that it referenced were setcookie methods:

    Code

    setcookie('phpBBLastVisitTemp', $temptime, time()+1800);


    I added a @ before the line and it seems to have corrected this issue.

    ex.

    Code

    @setcookie('phpBBLastVisitTemp', $temptime, time()+1800);


    hope this helps somebody. I pulled out almost all of my hair trying to figure this one out.
  • Actually, I don't think this fixes the error, but rather hides it from displaying onscreen.
  • well, I don't know whether it hides it or not, but it no longer kills the script.

    Prior to using the @, my scripts would die and give me this header warning, now no warning is displayed, and the page is proccessed correctly. I have not found anywhere that it has caused another issue. but i could be wrong.
  • @ is an error suppressor, I'm pretty sure.
  • I simply remarked them out. :)

    --
    www.appleproaudio.com

This list is based on users active over the last 60 minutes.