Can not send session cache limiter in session_start () [duplicate]

0

I have a conexao.php file that connects to the database, I add it to every page of my site using a require_once , right after that, I start the session with a session_start() .

The problem is that the session information is not being written 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]: Can not send session cache limiter - headers already sent (output started at"

If I put require_once below session_start() this problem disappears and the session returns to normal operation, however I have a problem with my layout (the page when it occupies 100% of the screen is blank when used scroll).

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

    
asked by anonymous 22.05.2015 / 17:38

3 answers

1

With this information, it can be deduced that conexão.php is sending content, or at least headers, and should not.

I deduce (because I do not have your code) that the connection to the database is generating a Warning that is not visible in the browser. You will either have to see the source code of the browser or use other software that will show you everything the server returns.

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

Then you need to resolve what is causing Warning or something.

Editing:

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

    
22.05.2015 / 17:50
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 end 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 string and you will not be able to start the section.

    
23.05.2015 / 16:37
-2

Hey guys, how are you? Thanks to all for your help. In the end, the problem was the background we were using. I do not know why, but we made a change in it and the problems were gone. Thanks to all for your help! We just returned the start_session () to the beginning, as it was before and with that change in the background it worked.

Again, thank you very much for the strength.

    
02.06.2015 / 22:35