Cannot send Session cache Limiter in session_start()

Asked

Viewed 9,623 times

0

I have a file conexao.php that makes the connection with the bank, I include it in all pages of my site using a require_once, right after this beautiful start the session with a session_start().

The problem is that the session information is not being recorded correctly, when accessing the system with another user the session will be with the data of the last logged in user, when changing login and password, etc. The error that appears to me is the following:

"Warning: session_start() [Function.Session-start]: Cannot send Session cache Limiter - headers already sent (output Started at "

If I put the require_once below the session_start() this problem disappears and the session returns to work normally, however I get a problem in my layout (the page when occupying 100% of the screen is blank when used scroll).

These problems are happening on my remote server (Advanced Host), when tested locally on a WAMP server it works normally.

  • Matheus, I recommend that format your question for a better understanding and also be readable. You can do this on [Edit]. Read more on [Ask]

  • Related question: http://answall.com/questions/4251/erro-do-php-cannot-modify-header-information

3 answers

1

From this information it appears that the conexão.php is sending content, or at least the headers, and should not.

I deduce (because I don’t have your code) that the connection to the database is generating a Warning that is not visible in the browser. You will need to see the browser source code or use another software that shows you better everything the server returns.

To see everything the server sends, there is the HTTP Client for OS X, but for Windows I don’t know. In the latter case you can use something like Wireshark, network data analysis software/protocol, and look at the contents of data packets.

Then you need to figure out what’s generating Warning or something.

Editing:

Another thing to check is if there is any problem in accessing the database itself. The component of the database may not return an error and the functions must be executed in order to know what is happening, for example mysql_error().

0

The section should be started at the beginning of the code, if there is any string before you start the section it will give error.

You need to finish the section before logging in with another user.

session_destroy();

If you leave a space in the previous code PHP will turn that space into a string and you cannot start the section.

-2

Hey guys, all right? Thanks for all your help. After all, the problem was in the background that we were using. I don’t know why, but we made a change in it and the problems disappeared. Thank you for all your help! We just returned the start_session() to the beginning, as it was before and with this change in the background it worked.

Again, thank you so much for the strength.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.