Support » Theme: Donovan » header already sent

  • Resolved khit

    (@khittner)



    I am getting error when I attempt session_start();.

    session_start();Cannot send session cookie – headers already sent by (…/themes/donovan/header.php)

    I went in and looked for white space but did not find any. Suggestions? Thank you, in advance, for your assistance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • khit

    (@khittner)

    I forgot to add line:10 in the header.php

    Theme Author ThemeZee

    (@themezee)

    Hi there,

    This is not a theme issue, you just can’t use session_start() in the header.php with WordPress.

    Please see https://stackoverflow.com/questions/11797351/how-to-use-session-start-in-wordpress

    Best,
    Thomas

    khit

    (@khittner)

    It is not in the header.php.
    However, UPDATE….
    I turned on output buffering on my server. ob_start();
    Error is now gone and all is functioning with session_start();, thus far.

    Having “white space” anywhere before calling the function will return the error snip I posted earlier 99% of the time. The error output shows the file and line #.

    Hoping this workaround does the trick, as it seems to, as there are no longer any errors.

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.