Jump to content

session_start errors


Obi1-Cannabis

Recommended Posts

hi, this is kind of weird and is driving me crazy i'm finding at my php_error_log.txt that sometimes there are one of this two errors when calling session_start()sometimes everything is ok, other times i get a Maximum execution time of 30 seconds exceeded in <SERVER>\app.php on line 13 and some other times i get this:

session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at <SERVER>\www\cesto\index.php:1) in <SERVER>\app.php on line 13
but this doesn't seem possible since all my code until the session_start is:
<?php	/*error_reporting(E_ALL);	ini_set('display_errors', '1');*/	//configuracao do header p3p privacy	header('P3P:CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT"');		/*header("Cache-Control: no-cache, must-revalidate");	header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");*/		//Configuracoes de Sessao	session_cache_limiter('none');	session_start();

does anyone have any idea why this might be happening?

Link to comment
Share on other sites

The error message is telling you what the problem is. There is output on index.php on line 1 that is causing the headers to be sent. The code in app.php raises the error because the headers were already sent. The problem is the index.php file that is sending the output on line 1.

Link to comment
Share on other sites

It just adds a header to the list of headers to send, it doesn't cause them all to immediately go out though. You can send multiple headers out, like when downloading a file.
That's what I had originally thought, but your post here seemed to imply otherwise.
Link to comment
Share on other sites

Yeah, this line isn't exactly accurate:

All the header functions does is send a header to the browser.
Technically, the header function causes a header to be sent to the browser, it doesn't actually send it though.That's my understanding, at least. It might also in fact be the case that the header function does actually send the header, but only if no non-header data has been sent (i.e., only if the only output has been headers so far). Regardless, using the header function once does not preclude using it a second time.
Link to comment
Share on other sites

yeah!there was no blank lines, however re-saving the file explicitly as utf-8 seems to have solved this one, though this had never happened to me before and never heard about this, why does it happen?and what about the timeout? any toughts?

Link to comment
Share on other sites

Timeout usually occurs if you have an infinite loop.There are two types of UTF-8: UTF-8 with BOM (Byte Order Mark) and UTF-8 on its own.If the UTF-8 has a BOM it sometimes may be interpretted has having a couple of characters as the beginning of the file, so you should make sure your editor saves the file without a BOM.

Link to comment
Share on other sites

There are two types of UTF-8: UTF-8 with BOM (Byte Order Mark) and UTF-8 on its own.If the UTF-8 has a BOM it sometimes may be interpretted has having a couple of characters as the beginning of the file, so you should make sure your editor saves the file without a BOM.
ok thanks for clarification :)
Timeout usually occurs if you have an infinite loop.
yes, but how come session_start() be considerided as an infinite loop? i'm prety sure it can't
Link to comment
Share on other sites

session_start shouldn't timeout. If it does, and it's using the default options for sessions, the only reason I can think of is that it's trying to open or create a session file and for whatever reason the OS is making it wait instead of either creating the file or failing. I haven't heard of something like that happening though, I also haven't heard of session_start causing a timeout. Also, "none" is not a valid value for the cache limiter.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...