php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29313 session_start
Submitted: 2004-07-22 02:26 UTC Modified: 2004-07-23 01:08 UTC
From: webmaster at behzad-m dot net Assigned:
Status: Not a bug Package: Session related
PHP Version: 4.3.8 OS: redhat
Private report: No CVE-ID: None
 [2004-07-22 02:26 UTC] webmaster at behzad-m dot net
Description:
------------
hi , 
when i use only this code  : 
<?php session_start();?>
i get this error :  "Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/novin/public_html/admin/test.php:1) in /home/novin/public_html/admin/test.php on line 1
"

http://www.9vin.com/admin/test.php
i have the same problem on an other domain of my server

Reproduce code:
---------------
<?php session_start();?>

Expected result:
----------------
no error page !!

Actual result:
--------------
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/novin/public_html/admin/test.php:1) in /home/novin/public_html/admin/test.php on line 1


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-23 01:08 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

You probably have some spaces or new lines before the <? 
 [2004-07-23 11:32 UTC] ProphetII at hotmail dot com
It's not a bug !

I had the same problem until I figured out this :

; Output buffering allows you to send header lines (including cookies) even
; after you send body content, at the price of slowing PHP's output layer a
; bit.  You can enable output buffering during runtime by calling the output
; buffering functions.  You can also enable output buffering for all files by
; setting this directive to On.  If you wish to limit the size of the buffer
; to a certain size - you can use a maximum number of bytes instead of 'On', as
; a value for this directive (e.g., output_buffering=4096).
output_buffering = on
 [2004-07-23 11:34 UTC] ProphetII at hotmail dot com
This flag has to be changed in the php.ini file
output_buffering = on

After that everything should work
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 06:01:29 2024 UTC