Cannot modify header information - 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: Cannot modify header information (/showthread.php?tid=13398) |
Cannot modify header information - El Forum - 11-20-2008 [eluser]Nathan Payne[/eluser] http://www.haunted-houses.net/admin I am getting the following error: Quote:A PHP Error was encountered This happens when I try to access the admin section of my sites. I have attached the code for my admin section below. Controller: Code: <?php Model: Code: <?php View: Code: <div id="content"> Also when I submit the form I get the following: Quote:Severity: Warning Cannot modify header information - El Forum - 11-20-2008 [eluser]Armchair Samurai[/eluser] Perhaps this is far too obvious a question, but what's on line 37 in Layout.php? From the errors, sounds like it's outputting something to the browser. Cannot modify header information - El Forum - 11-20-2008 [eluser]Nathan Payne[/eluser] [quote author="Armchair Samurai" date="1227253725"]Perhaps this is far too obvious a question, but what's on line 37 in Layout.php? From the errors, sounds like it's outputting something to the browser.[/quote] Layout.php is below. I have hunted the files for blank space etc. Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); Cannot modify header information - El Forum - 11-21-2008 [eluser]Nathan Payne[/eluser] Can anyone help? Cannot modify header information - El Forum - 11-21-2008 [eluser]Bogdan Tanase[/eluser] if this line executes before redirect, then it won't work, because it will output headers to the browsers. Code: $this->obj->load->view($this->layout, $loadedData, false); Cannot modify header information - El Forum - 11-21-2008 [eluser]Berserk[/eluser] -change your output_buffering = ON -check your file encode (i encoded in UTF-8 and get the same problem) Cannot modify header information - El Forum - 11-21-2008 [eluser]Armchair Samurai[/eluser] Berserk has an excellent point - if you've encoded in UTF-8, there might be the invisible BOM mark at the beginning of your files which needs to be removed (easy enough, depending on your text editor) otherwise you will get the "Cannot modify header information" error. Also, unrelated to the problem at hand, you've failed to load the model admin_model in your controller function verify where you actually need to access it, as opposed to index where it's loaded but not used. Cannot modify header information - El Forum - 11-21-2008 [eluser]Nathan Payne[/eluser] How do I change output_buffering = ON? What text editor is best for too see the BOM marks? Thanks. Cannot modify header information - El Forum - 11-21-2008 [eluser]Berserk[/eluser] sorry i forgot, let's find in php.ini, also you must have permission to edit. I'm using Notepad++ with "Encode in UTF-8 without BOM" Mode. If you're encoding your controller file in UTF-8, please convert to ANSI or UTF-8 without BOM ( at Notepad++'s Format Option). |