Session error message

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Toneboy
Forum Contributor
Posts: 102
Joined: Wed Jul 31, 2002 5:59 am
Location: Law, Scotland.
Contact:

Session error message

Post by Toneboy »

Just tried looking up one of my pages and received the following message:

Code: Select all

Warning: Cannot send session cache limiter - headers already sent (output started at /home/sites/site48/web/sub/index.php:3) in /home/sites/site48/web/templates/header1.php on line 6
I know about sending sessions before anything else, but this page isn't different to any other (the first line is a string for the title bar, then there is an include for the session and header). Any ideas what I should look for when trying to solve the problem?

Ta in advance.
User avatar
RandomEngy
Forum Contributor
Posts: 173
Joined: Wed Jun 26, 2002 3:24 pm
Contact:

Post by RandomEngy »

Well, the output started at line 3, and you tried to start the session on line 6. I'm guessing line 3 is one of your includes. Remeber not to have any whitespace in your include files. The first characters should be <? and the last be ?> . If there is whitespace, it will output them as so, and prevent you from starting a session or sending another header(). If you still can't get it to work, just put an ob_start(); at the top of your page and it should go okay.
User avatar
Toneboy
Forum Contributor
Posts: 102
Joined: Wed Jul 31, 2002 5:59 am
Location: Law, Scotland.
Contact:

Post by Toneboy »

Worked like a charm, thanks! :D
Post Reply