Quote:
Originally Posted by glen290
Got this error on my sites arcade appear
Unable to add cookies, header already sent.
File: /home/tenpinfo/public_html/arcade.php
Line: 1820
Anybody got an idea what this is ?
|
Did you edit it? Works fine at my end and it's a great script. Any attempt to set cookies must be done before any other output. A white space above <?PHP is considered output. First look for output before set_cookie or any header statement. Both are problem children if you already started sending output. Any HTML before set_cookie is also output that will cause this error.
You can use output buffering to send output prior to the call of this function, with the overhead of all of your output to the browser being buffered in the server until you send it. You can do this by calling ob_start() and ob_end_flush() in your script, or setting the output_buffering configuration directive on in your php.ini or server configuration files.
I usually run set cookies like this:
Code:
ob_start();
set_cookie(PARAMS HERE);
ob_end_flush();
This gets me around the set_cookie problem when other output has already been sent, which can also be an echo or print_r or similiar.