![]() |
headers already sent problem - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: headers already sent problem (/showthread.php?tid=3610) |
headers already sent problem - El Forum - 10-13-2007 [eluser]maks80[/eluser] Hi, I've just started to use CodeIgniter and I have big problem on the begining with sessions or sending cookies. Here is page with error. error page This page is CodeIgniter 1.5.4, after downloading I just added session library to autoload.php and I didn't change anything more. Could you advice me how I can solve the problem? headers already sent problem - El Forum - 10-13-2007 [eluser]leonglass[/eluser] I would have thought that the problem is you are using the session after the view has already started producing the page. Headers already sent errors mean that the page output has already begun. As you can see from my post count I am pretty new here myself so not that well versed with CI yet either. At which point are you calling the session start method? It has to be done before you issue any print or echo statements. Sometimes it is ok (as your error page has produced the welcome page) to use for debugging purposes so you can print some text in your model or controller portions to see what is happening and this will generate the error but the rest of the page is still rendered. headers already sent problem - El Forum - 10-13-2007 [eluser]maks80[/eluser] I didn't change "welcome" controller: Code: <?php Code: $autoload['libraries'] = array('session'); headers already sent problem - El Forum - 10-13-2007 [eluser]smith[/eluser] It is possible that you are printing space somewhere during session setup. Did you try to set some session variables? are you sure that your .htaccess is ok? you didn't tell us everything, you are using cookies too... your script breaks while trying to set cookie headers already sent problem - El Forum - 10-14-2007 [eluser]maks80[/eluser] Quote:It is possible that you are printing space somewhere during session setup.I didn't change anything in scripts after I downloaded it from CodeIgniter webpage. Quote:Did you try to set some session variables? Yes, but still is the same. Here is link to my test page and below is my controller. Code: class Welcome extends Controller { Quote:are you sure that your .htaccess is ok?I dont have .htaccess. headers already sent problem - El Forum - 10-14-2007 [eluser]smith[/eluser] what is the content of this file: /usr/local/apache/www/htdocs/fcliverpool.pl/test/zuzel/index.php also, codeigniter includes .htaccess by default headers already sent problem - El Forum - 10-14-2007 [eluser]maks80[/eluser] [quote author="smith" date="1192376509"]what is the content of this file: /usr/local/apache/www/htdocs/fcliverpool.pl/test/zuzel/index.php also, codeigniter includes .htaccess by default[/quote] index.php is a standard index form CodeIgniter I didn't change anything: Code: <?php Where I can finde .htacces, because I didn't create it and I can't finde it in downloaded package. headers already sent problem - El Forum - 10-14-2007 [eluser]nmweb[/eluser] You don't need it anyway, but you can find it in the wiki. Search for it and you will find it. Problem you encounter is that you output something before you send the cookies. Make sure you delete all spaces before or after the <?php or ?> in the files you modified. Double check this. headers already sent problem - El Forum - 10-14-2007 [eluser]Majd Taby[/eluser] this happens when you have either a new line before/after you <?php ?> tags, or even a single space, make sure you check for that headers already sent problem - El Forum - 10-14-2007 [eluser]Derek Allard[/eluser] Agreed with Zaatar. http://expressionengine.com/knowledge_base/article/warning_cannot_modify_header_information/ |