Jump to content

Question about session.auto_start config and function session_start()


Recommended Posts

Hey, guys.

 

I've just 'finished' some project of mine, and then I tried to post it in the enterprise's server.

 

Then the problem started in the first page, the login page:

 

"Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /var/www/anfip-2007/site_anfip/Fundacao_ANFIP/fundagenda/index.php:9) in /var/www/anfip-2007/site_anfip/Fundacao_ANFIP/fundagenda/index.php on line 10"

 

And this other error, same page:

 

"Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /var/www/anfip-2007/site_anfip/Fundacao_ANFIP/fundagenda/index.php:9) in /var/www/anfip-2007/site_anfip/Fundacao_ANFIP/fundagenda/index.php on line 10"

 

 

Now, let me try to understand something.

The problem is with the session_start function...    (tnx, Sherlock...)

 

1. The session_start function failed to create a cookie because there is one already.

2. It also failed because the session limiter was already set.

 

(this is what I understood of the problem, if it isn't right, please tell me)

 

 

So...

 

Is it possible to the session.auto_start is set to '1', and that if it is, I cannot create again a session?

I don't know much of how the session works, and stuff...

 

So I dont know if it is already started, if it is a problem to start again.

 

Can someone help me?

The error is occurring at the session_start() statement, but it is caused by the output your script is sending before that point -

 

output started at ..../index.php:9

 

The reason your code worked on your development system is because your development system has output_buffering turned ON, which hid this problem. In order to develop code that will work on the greatest number of systems without needing to mess with settings every time you move it to a different server configuration, turn output_buffering off.

Dude...

 

This server configuration you're talking about, the output_buffering...

I read about it in php.net, and then I could understand what you are talking about.

 

The output_buffering configuration turned ON, let the cookies be started anywhere at the PHP document, but when it's turned OFF, cookies initialization like session_start() must be the first line of the page, before any HTML tag.

 

Is it right?

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.