|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2937 session_start() fails when used after require() or include()
Submitted: 1999-12-08 14:06 UTC Modified: 1999-12-10 06:11 UTC
From: marvin at minotaur dot com Assigned:
Status: Closed Package: Session related
PHP Version: 3.0.12 OS: linux
Private report: No CVE-ID: None
 [1999-12-08 14:06 UTC] marvin at minotaur dot com
I am using PHP 4.0 beta 2

Basically if I do


   require 'htmlstuff.php'

   blah blah blah

the code works...

but if I do


  require 'htmlstuff.php'


  blah blah blah

I get an error reading like:

Warning: Cannot add header information - headers already sent in /home/marvin/sla/index.php on line 5

If I use include instead of require, same error message.  This also means I can not use session_start inside of a function in a header file.

Contact me for clarifications/more info.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1999-12-10 06:11 UTC] sas at cvs dot php dot net
You have some kind of white-space in your included files which triggers sending the HTTP headers. Either enable output buffering or remove the white-space in the included files.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Dec 11 13:01:29 2023 UTC