Session Issues

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
User avatar
egami
php-forum GURU
php-forum GURU
Posts: 2196
Joined: Wed Oct 06, 2010 11:19 am
Location: Happy Valley, UT

Re: Session Issues

Post by egami » Wed Sep 26, 2012 2:35 pm

This usually occurs when you're sending out your headers before hand. ie.. you have like..

<?php
include ('headers.php'); // this file that contains <!DOCTYPE HTML.. etc..


is this file being "included" or is it being called from a form?

faust
New php-forum User
New php-forum User
Posts: 109
Joined: Thu May 03, 2012 7:22 am

Re: Session Issues

Post by faust » Thu Sep 27, 2012 1:53 am

include('config.php');
If you have any output to the browser in this file, header() won't work.

seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: Session Issues

Post by seandisanti » Tue Oct 02, 2012 1:12 pm

As they said, any output to the browser before the session_start() will throw error. that includes empty lines before <?php tag, OR if you have other php files included before that one that have trailing empty lines after a ?> closing tag. You can also bypass the error by enabling output_buffering in your php.ini (or manually each time as Harok suggested).

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests