Jump to content

Problems with php sessions


cybercrypt13

Recommended Posts

We had a website that worked perfectly up until Friday. Since Friday when we open a page we get the following error. No code changes within the site took place so this has to be some sort of configuration problem but I don't know what.

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


Thanks
Link to comment
Share on other sites

Thats not an answer but a restatement of the obvious. As I stated, nothing has changed in our source code so I don't see how it could possibly have problems. Something has changed in the configuration on the server somewhere that has caused this problem. its the only thing that makes sense. I've checked the global property in php.ini and its turned on.

However, there are more than one php.ini file. Can anyone tell me how to determine which one is being used by php?

THanks,
Link to comment
Share on other sites

I need to clarify a few things now that I better understand the problem.

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.

Any ideas?
Link to comment
Share on other sites

  • 2 years later...
Usually that issue, at least in my experience, is because you are sending a header function after something else is already being outputted.  All header functions have to be processed before any code *even blank space* can be outputted.

http://us3.php.net/manual/es/function.header.php

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.

http://us.php.net/ob_start

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.