使用会话codeigniter时出错

I have a problem while publishing my site. I have a autentication system using session by codeigniter. When it's run on localhost, its perfect. But when i publish in the server (hosting godaddy), It display this message Severity: Warning

Message: session_start(): Cannot send session cookie - headers already sent by (output started at /home/cristiandelacruz/public_html/crmappsdc/application/config/config.php:1)

Filename: controllers/Login.php

It means you have something output on browser while redirection.

You can do following things:

1) Check which code is printing HTML. And remove it. eg. Spaces, echo or print statements.

2) if this does not work, add ob_start (); at the file beginning. It stores output in buffer and redirection occurs.

Check if you have blank space before php opening tag in message mentioned file. Try again to save that file without BOM (Copy content into new file and double check you don't have blank space or any characters before file start and save it encoded in UTF-8 without BOM). Maybe helps.

this is happening because your local environment does not have full error reporting turned on, while your hosting provide does. The problem is most likely always there. The reason to that problem is most likely that you are calling Codeigniter's session class $this->session-> ... , however somewhere in the loading of your application, PHP already encountered this: session_start(). To fix it, you need to debug your program and find out where the session is being initialized because the way its currently set up, it is being initialized twice.

Cause:

This error is caused if the your PHP scripts are printing to the browser prior to sending headers. A common example is printing the html tags prior to starting a session, or setting a cookie. The error tells the line that needs to be altered (in this case, it is on /config.php).

Resolution:

To resolve this error remove the lines from the PHP code that are printing to the browser prior to sending headers.

Another common cause for this error is white space either at the beginning or end of the file. The fix is to remove that whitespace from the file. Read the error message carefully. It says output started at ... followed by a file name and a line number. That is the file (and line) that you need to edit. Ignore the second file name - that is only a file that included the file that has the whitespace. The first file is the one you have to edit, not the second one

Source from WHAT DO I DO WHEN I RECEIVE A PHP HEADER ERROR MESSAGE? GoDaddy Forum

Codeigniter Seesion class

I tried above all solutions. finally, I Changed output_buffering in PHP.ini (GoDaddy Server)

output_buffering = on

In PHP 5.4 version by default output_buffering has no value I updated the PHP version 5.4 to 5.6 and in 5.6 version by default it has value 4096 Now it's working fine