473,737 Members | 1,808 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how do I fix this " Warning: session_start() : Cannot send session cache limiter"

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:
[24-May-2006 19:51:22] PHP Warning: session_start() : Cannot send
session cache limiter - headers already sent in
/home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandStartSes sion.php
on line 14
[24-May-2006 19:51:22] PHP Warning: Cannot modify header information -
headers already sent in
/home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandSetMachi neIdOnVisitorsM achine.php
on line 26
[24-May-2006 19:51:26] PHP Warning: session_start() : Cannot send
session cache limiter - headers already sent in
/home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandStartSes sion.php
on line 14
[24-May-2006 19:51:26] PHP Warning: Cannot modify header information -
headers already sent in
/home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandSetMachi neIdOnVisitorsM achine.php
on line 26
[24-May-2006 19:54:42] PHP Warning: session_start() : Cannot send
session cache limiter - headers already sent in
/home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandStartSes sion.php
on line 14
[24-May-2006 19:54:42] PHP Warning: Cannot modify header information -
headers already sent in
/home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandSetMachi neIdOnVisitorsM achine.php
on line 26
[24-May-2006 19:54:45] PHP Warning: session_start() : Cannot send
session cache limiter - headers already sent in
/home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandStartSes sion.php
on line 14
[24-May-2006 19:54:46] PHP Warning: Cannot modify header information -
headers already sent in
/home/httpd/vhosts/monkeyclaus.org/httpdocs/media/audio/pdsIncludes/CommandSetMachi neIdOnVisitorsM achine.php
on line 26

but the lines they are pointing to are

session_start() ;
session_registe r();

May 25 '06 #1
19 7925
NC
lawrence k wrote:

How can I find out where my script is outputting to the screen
for the first time?
It may not be your script; it could be one of the files you are
including...
My error logs are full of stuff like this: .... but the lines they are pointing to are

session_start() ;
session_registe r();


You probably have a blank space or an empty line somewhere between the
beginning of a file and the first "<?"... Find it and delete it.
Alternatively, use output buffering; start buffering at the beginning
of the script and dump the buffer after you're done working with
sessions...

Cheers,
NC

May 25 '06 #2
In article <11************ **********@38g2 000cwa.googlegr oups.com>,
lawrence k <lk******@geoci ties.com> wrote:
[24-May-2006 19:51:22] PHP Warning: Cannot modify header information -
headers already sent in


You're sending some of the body before the session is started. Don't
do that ;)

--
http://www.spinics.net/lists/php/
May 26 '06 #3
Actually there could be a space or blank line before any <?, after any ?>,
any html in files included in the script or even a header statement prior to
the session start statement. You can try starting the session at the
begining of the file and then moving it back to where you had it until you
find the offending code.

Just remember the session start has to be done prior to any output being
sent.

James
May 26 '06 #4
you must place the header() function ontop of everything in the code.
if your trying to redirect use javascript.

May 28 '06 #5

Someuser wrote:
Actually there could be a space or blank line before any <?, after any ?>,
any html in files included in the script or even a header statement prior to
the session start statement. You can try starting the session at the
begining of the file and then moving it back to where you had it until you
find the offending code.
Just remember the session start has to be done prior to any output being
sent.


I know that. My question was how do I find out where the output
starts? My system has 1800 PHP files. I can't go through them one at a
time looking for white space..

May 31 '06 #6

NC wrote:
lawrence k wrote:

How can I find out where my script is outputting to the screen
for the first time?
It may not be your script; it could be one of the files you are
including...
My error logs are full of stuff like this:

...
but the lines they are pointing to are

session_start() ;
session_registe r();


You probably have a blank space or an empty line somewhere between the
beginning of a file and the first "<?"... Find it and delete it.


I know that. My question was how do I find out where the output
starts? Is there an IDE that would check this for me?

My system has 1800 PHP files. I can't go through them one at a time
looking for white space.

Alternatively, use output buffering; start buffering at the beginning
of the script and dump the buffer after you're done working with
sessions...


That would disguise the problem, but a year frow now it would probably
come back and bite me. I need to fix the true problem, not hide it.

May 31 '06 #7
Rik
lawrence k wrote:
My system has 1800 PHP files. I can't go through them one at a time
looking for white space.

900
450
225
123
62
31
16
8
4
2
1

That's the road to take when searching for this, 11 easy steps, unless the
problem is in more then one document. Also, a real editor could search files
for input before '<?'.

You could offcourse make PHP do the work for you:
$files = array of files included/'on your system'
Loop through the text equivalent of your files with a regular expression
like (.+)<? on the beginning of every file.

Or use ob_start()
And 1800 if(ob_get_conte nts()!='') echo "problem is
before".__FILE_ _','__LINE__;'s

And it's not a matter of "your system", it's a matter of files that are
included before the header call().
If that's indeed > 1800 files:
- I'm very curious on what bases you put code in different files, and what
the exact goal of your script actually is to include that many.
- I'd suggest a more sensible grouping then "1800 files", so you can exclude
groups (maybe fake output) of files in this kind of troubleshooting .

Grtz,
--
Rik Wasmus
Jun 1 '06 #8

Rik wrote:
lawrence k wrote:
My system has 1800 PHP files. I can't go through them one at a time
looking for white space.

a real editor could search files
for input before '<?'.


Good point. Homesite could do that for me, or Jedit. I appeciate the
suggeston.

Or use ob_start()
And 1800 if(ob_get_conte nts()!='') echo "problem is
before".__FILE_ _','__LINE__;'s
Thanks, that is a great idea. I'll try to rig up a test.
- I'm very curious on what bases you put code in different files, and what
the exact goal of your script actually is to include that many.
- I'd suggest a more sensible grouping then "1800 files", so you can exclude
groups (maybe fake output) of files in this kind of troubleshooting .


Every function and class is in its own file, because usually less than
300 are needed for any given project, so there is no point including
them all on every page. There is a central object that includes them
when they are needed.

Jun 1 '06 #9

NC wrote:
lawrence k wrote:

How can I find out where my script is outputting to the screen
for the first time?


It may not be your script; it could be one of the files you are
including...
My error logs are full of stuff like this:

...
but the lines they are pointing to are

session_start() ;
session_registe r();


You probably have a blank space or an empty line somewhere between the
beginning of a file and the first "<?"... Find it and delete it.
Alternatively, use output buffering; start buffering at the beginning
of the script and dump the buffer after you're done working with
sessions...


Well, I probably do have some open white space in the code. I did a
search for it and found at last 6 files that were leaking white space.
I fixed those 6 files. Sadly, my error logs are still full of "Warning:
session_start() : Cannot send session cache"...

I'm going crazy. I can't set sessions because my code is leaking white
space. I can't find a way to track down that white space. Surely there
is an IDE or test kit that will help me track this down?

Jun 17 '06 #10

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

Similar topics

1
8927
by: Mercy | last post by:
Hi, I'm a newbie. I was trying to figure out how to use the Session_start method? The reference books I'm reading say that a session STARTS when "session_start" is called. But ... in their sample code... I never see that explicitly called. Is it supposed to be called from the Global.asa file (still not sure what that is...) Is "session_start" a server-side scripting thing? Or a client-side scripting thing? I'd really appreciate a nice...
3
445
by: Tim Marsden | last post by:
Hi, When I open my VS2003 solution it looks up "Initializing offline cache", if I end it and reopen its OK. Any suggestions? Tim
4
5042
by: Ottar | last post by:
Error: 80040108 after 380 CreateObject("MAPI.Session") Function MAPI_Test2() Dim i As Integer Dim MySession As MAPI.Session i = 0 While (i < 2000) Set MySession = CreateObject("MAPI.Session") Debug.Print i
14
5918
by: dale zhang | last post by:
Hi groups, Can anyone give me the equivalent C# sharp code for this VB.ET code, :: VB.NET :: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _ Handles MyBase.Load 'This event routine in the loginCheck user control fires when the
3
2118
by: Jeff Smythe | last post by:
I simply want to execute some code once when a new session of my ASP.NET application is started (I'm not using session state for anything else - just writing some data to a database). I thought that I could simply put the code in the Session_Start event procedure in Global.asax.cs, however, the event procedure executes and a new session is created every time any page is requested - not just for the first page requested....
3
2427
by: Peter Theill | last post by:
Hi, I'm trying to include the content of a request into an Xml document: if (System.Web.HttpContext.Current.Session != null) { XmlDocument d = new XmlDocument(); d.Load(new XmlTextReader("http://localhost/page.aspx")); } The requested page (page.aspx) is an XHTML page so I'm able to parse it as a
17
4239
by: StevePBurgess | last post by:
A really simple script is driving me up the wall. I have a very simply facility on a website to allow the user to reorder items in a database table as she wishes by clicking a link that (in this case) says "MOVE UP" and links to the script below. This script snippet that does all the work is shown - the database connection is established and after doing its work the script returns the user to the referring page.
1
9257
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9204
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8203
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6749
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4567
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4823
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3278
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.