Problems with php sessions
Posted 03 April 2006 - 01:58 PM
Can any help?
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/softekso/public_html/tbamu/functions.php:68) in /home/softekso/public_html/tbamu/main/body_header.php on line 2
Posted 03 April 2006 - 02:19 PM
Posted 03 April 2006 - 03:08 PM
However, there are more than one php.ini file. Can anyone tell me how to determine which one is being used by php?
Posted 03 April 2006 - 03:58 PM
I have a function.php that stores a bunch of functions one of which connects to the db. This function accesses a session var to determine the name of the db and its always worked perfectly for years.
Now, upon trying to access the sessionvar it is finding it to be an empty string, despite the fact that the variable exists on other pages. I have the session_start(); line as the only line directly after <? and again, none of this code has changed so it has to be something on the server thats caused this to act this way.
Posted 18 December 2008 - 08:56 PM
There are 2 ways that I know of to fix this. First one is to make sure that you are only using the header function at the top of all processed pages, before any other code is ran. The second, and easier, way to handle this is ob_start and ob_end_flush functions.
If you use those on the page, then everything between them will buffer before any code is outputted. As to why it just started happening, I can't tell you. Did anyone change your configuration of PHP? My guess is that there was some sort of error reporting option that was turned off before and someone turned on. I had the same issue when I swapped a PHP-driven site from a host to my personal web server and I used output buffering to fix it.
Posted 18 December 2008 - 09:00 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users