Title: Cannot send session cookie
Last modified: August 31, 2016

---

# Cannot send session cookie

 *  [gpinyol10](https://wordpress.org/support/users/gpinyol10/)
 * (@gpinyol10)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/cannot-send-session-cookie/)
 * Hi,
    I’m trying to make a cookie sesion manually in php but when I write php 
   code in one page, I have this error:
 * Warning: session_start(): Cannot send session cookie – headers already sent by(
   output started at C:\xampp\htdocs\sunwaychessfestival\wp-content\plugins\sitepress-
   multilingual-cms\inc\language-switcher.php:1038) in C:\xampp\htdocs\sunwaychessfestival\
   wp-content\plugins\shortcode-exec-php\shortcode-exec-php-class.php(895) : eval()’
   d code on line 1
 * Warning: session_start(): Cannot send session cache limiter – headers already
   sent (output started at C:\xampp\htdocs\sunwaychessfestival\wp-content\plugins\
   sitepress-multilingual-cms\inc\language-switcher.php:1038) in C:\xampp\htdocs\
   sunwaychessfestival\wp-content\plugins\shortcode-exec-php\shortcode-exec-php-
   class.php(895) : eval()’d code on line 1
 * I read and I think this is because session_start has to be in the first line 
   of any php code, and this happens because firstly there is the function.php file.
   
   But I don’t know how to fix that cause I only need the session_start in 3 pages,
   so I want to put in this pages the code.
 * I hope somebody can help me with that.
    Thank you,
 * Gemma

Viewing 1 replies (of 1 total)

 *  [Takis Bouyouris](https://wordpress.org/support/users/nevma/)
 * (@nevma)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/cannot-send-session-cookie/#post-6986301)
 * Hi, Gemma,
 * Cookies are sent inside HTTP headers which precede any HTML that the server sends
   to the browser. So what you need to do is make sure you set your cookie prior
   to any HTML having been sent to the browser. The correct way to do this is to
   attach your code in the appropriate WordPress hooks that runs as early as possible
   during each request. This hook might be the ‘init’ hook or ‘theme_init’, but 
   this is something you will have to decicde for yourself according to your specific
   needs and the rest of the code that you are using (theme, plugins, etc).

Viewing 1 replies (of 1 total)

The topic ‘Cannot send session cookie’ is closed to new replies.

## Tags

 * [20q2016](https://wordpress.org/support/topic-tag/20q2016/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [Takis Bouyouris](https://wordpress.org/support/users/nevma/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/cannot-send-session-cookie/#post-6986301)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
