473,408 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Common session_start() error..

I am getting the error message below when ever I try to start my script
on two different servers. I am not getting any errors off of my PC. I
have looked around and found the answer a simple one. I can not stop the
error in my script. The session_start() is the first thing that happens
before any Headers are created. Any one have any suggestions. Include
the start of the code that uses the session var.
Warning: session_start(): Cannot send session cookie - headers already
sent by (output started at
/home/www/ichbinquotations.awardspace.com/quotes/quotes.php:1) in
/home/www/ichbinquotations.awardspace.com/quotes/quotes.php on line 8

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
/home/www/ichbinquotations.awardspace.com/quotes/quotes.php:1) in
/home/www/ichbinquotations.awardspace.com/quotes/quotes.php on line 8

<?php
/**
*
*
* @version $Id$
* @copyright 2006
*/
session_start();
if(!isset($_SESSION['abbr_letter']))
$_SESSION['abbr_letter'] = 'A';

require_once 'includes/config.inc.php';
require_once 'includes/header.inc.php';
//
// Start a Form
?>
<html>
<head>
<style type="text/css" >
body {
margin-left: 10%; margin-right: 10%;
color: purple;
background-color: #FFFFF2;
}
quote{ background-color: white }
</style>
</head>
<b><FORM NAME="author_abbrv" method="POST" action="<?php echo
$_SERVER['PHP_SELF'];?>"></b>
<input type="radio" name="abbr_letter" value="A" checked="TRUE"
onclick="submit()"A
<input type="radio" name="abbr_letter" value="B" onclick="submit()"B
<input type="radio" name="abbr_letter" value="C" onclick="submit()"C
<input type="radio" name="abbr_letter" value="D" onclick="submit()"D
<input type="radio" name="abbr_letter" value="E" onclick="submit()"E
<input type="radio" name="abbr_letter" value="F" onclick="submit()"F
<input type="radio" name="abbr_letter" value="G" onclick="submit()"G
<input type="radio" name="abbr_letter" value="H" onclick="submit()"H
<input type="radio" name="abbr_letter" value="I" onclick="submit()"I
<input type="radio" name="abbr_letter" value="J" onclick="submit()"J
<input type="radio" name="abbr_letter" value="K" onclick="submit()"K
<input type="radio" name="abbr_letter" value="L" onclick="submit()"L
<input type="radio" name="abbr_letter" value="M"
onclick="submit()"M <br>
<input type="radio" name="abbr_letter" value="N" onclick="submit()"N
<input type="radio" name="abbr_letter" value="O" onclick="submit()"O
<input type="radio" name="abbr_letter" value="P" onclick="submit()"P
<input type="radio" name="abbr_letter" value="Q" onclick="submit()"Q
<input type="radio" name="abbr_letter" value="R" onclick="submit()"R
<input type="radio" name="abbr_letter" value="S" onclick="submit()"S
<input type="radio" name="abbr_letter" value="T" onclick="submit()"T
<input type="radio" name="abbr_letter" value="U" onclick="submit()"U
<input type="radio" name="abbr_letter" value="V" onclick="submit()"V
<input type="radio" name="abbr_letter" value="W" onclick="submit()"W
<input type="radio" name="abbr_letter" value="X" onclick="submit()"X
<input type="radio" name="abbr_letter" value="Y" onclick="submit()"Y
<input type="radio" name="abbr_letter" value="Z" onclick="submit()"Z
<br>
</FORM>
<b><FORM NAME="author" method="POST" action="<?php echo
$_SERVER['PHP_SELF'];?>"></b>
<SELECT NAME="author_pk" SIZE="20" COLS="10" onclick="submit()">

<?php
//
//Check for the first time pass
if( !isset($_POST['abbr_letter']) ) {
$_POST['abbr_letter'] = $_SESSION['abbr_letter'];
}
//
//If already set then reset the local Var to the Session
$_SESSION['abbr_letter'] = $_POST['abbr_letter'];
//
//Setup for the database call for authors by first letter
$sqlcmd = $author_detail_select_by_Letter . $_POST['abbr_letter']
. $author_detail_orderBy;

--
Thanks in Advance... http://ichbin.9999mb.com
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
__________________________________________________ ____________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Nov 6 '06 #1
2 1829
On Sun, 05 Nov 2006 23:17:19 -0500, IchBin <we******@ptd.netwrote:
>I am getting the error message below when ever I try to start my script
on two different servers. I am not getting any errors off of my PC. I
have looked around and found the answer a simple one. I can not stop the
error in my script. The session_start() is the first thing that happens
before any Headers are created. Any one have any suggestions. Include
the start of the code that uses the session var.

Warning: session_start(): Cannot send session cookie - headers already
sent by (output started at
/home/www/ichbinquotations.awardspace.com/quotes/quotes.php:1) in
/home/www/ichbinquotations.awardspace.com/quotes/quotes.php on line 8

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
/home/www/ichbinquotations.awardspace.com/quotes/quotes.php:1) in
/home/www/ichbinquotations.awardspace.com/quotes/quotes.php on line 8

<?php
Do you really have this indentation in the script before the <?php tag? If so,
that's where the output is coming from - and that's also backed up by the error
saying the output started on line 1.

It's possible to mask these problems by turning on one of the variants of
output_buffering, but it's best practice to eliminate the output before any
headers are sent so it works with or without buffering. This may explain why
you see it on one setup but not the other - you probably have buffering (or
zlib output compression) turned on.

--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 6 '06 #2
Andy Hassall wrote:
On Sun, 05 Nov 2006 23:17:19 -0500, IchBin <we******@ptd.netwrote:
>I am getting the error message below when ever I try to start my script
on two different servers. I am not getting any errors off of my PC. I
have looked around and found the answer a simple one. I can not stop the
error in my script. The session_start() is the first thing that happens
before any Headers are created. Any one have any suggestions. Include
the start of the code that uses the session var.

Warning: session_start(): Cannot send session cookie - headers already
sent by (output started at
/home/www/ichbinquotations.awardspace.com/quotes/quotes.php:1) in
/home/www/ichbinquotations.awardspace.com/quotes/quotes.php on line 8

Warning: session_start(): Cannot send session cache limiter - headers
already sent (output started at
/home/www/ichbinquotations.awardspace.com/quotes/quotes.php:1) in
/home/www/ichbinquotations.awardspace.com/quotes/quotes.php on line 8

<?php

Do you really have this indentation in the script before the <?php tag? If so,
that's where the output is coming from - and that's also backed up by the error
saying the output started on line 1.

It's possible to mask these problems by turning on one of the variants of
output_buffering, but it's best practice to eliminate the output before any
headers are sent so it works with or without buffering. This may explain why
you see it on one setup but not the other - you probably have buffering (or
zlib output compression) turned on.
Thanks Andy that was the problem. Sorry, I am new to PHP and I do not
understand why those four spaces would give me a problem. The "output of
what" is coming from where? It looks like I do have zlib output
compression ala phpinfo().

--
Thanks in Advance... http://ichbin.9999mb.com
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
__________________________________________________ ____________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
Nov 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Florence HENRY | last post by:
Hello, I've searched about my problem on google before posting, but I didn't find anything relevant... I have a problem with session_start. Here is my code : <html> <head> <?php...
2
by: Reply-Via-Newsgroup Thanks | last post by:
Folks, I consider myself a reasonably strong PHP programmer, but I've not used sessions before (I've used cookies instead) and I'd appreciate it if someone could confirm something for me. ...
3
by: Trogdor | last post by:
I set up a server on an AMD 650 machine running gentoo linux. I installed Apachie 2, MySQL 4.1 and PHP 4.3.11 I use another computer on my local net (192.168.0.x) to access the server as a...
8
by: lkrubner | last post by:
I was trying to set a cookie before I called session_start() and it was giving me an error. But isn't sessions really just a cookie? Why would it matter if I sent a cookie before session_start? Can...
4
by: Curious George | last post by:
I have a frameset with multiple aspx pages whithin it. I lauch the page and notice that it triggers many session_start events. In fact I knotice multiple events for the same page. I am also...
4
by: csn | last post by:
Is it possible to have a Response.Redirect in Global.asax in the Application_Start and Session_Start events? We have code in both events, with try-catch blocks, and if an exception is caught, we...
19
by: lawrence k | last post by:
How can I find out where my script is outputting to the screen for the first time? My error logs are full of stuff like this: PHP Warning: session_start(): Cannot send session cache...
6
by: comp.lang.php | last post by:
I am using session_start() on index.php and for some reason sometimes it'll fail. No warnings, no errors, no notices, not even after prepending error_reporting(E_ALL) and ini_set('display_errors',...
6
Markus
by: Markus | last post by:
Things to discuss: Headers What are they? What does PHP have to do with headers? Why can they only be sent before any output? Common causes
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.