Codeigniter header() error
NickName:Kevin Simper Ask DateTime:2011-09-14T05:34:41

Codeigniter header() error

I have run into this problem in my Codeigniter app:

A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /application/controllers/training.php:1)
Filename: libraries/Session.php
Line Number: 671

I have been checking for whitespaces and I am not sending headers.

The ONLY way this error appears is when I am updating the view and controller files.

My code ran fine until I updated some files, then the error (above) refuses to disappear.

When I clear my cache and log back in again, the error doesn't show.

Does anyone know why?

Copyright Notice:Content Author:「Kevin Simper」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/7408827/codeigniter-header-error

Answers
Timur 2011-09-13T21:59:07

May be UTF-8 BOM marker? Try saving training.php without BOM (if exists)",


Cyclone 2011-09-13T21:39:46

I'm not sure why it would appear and disappear like that, but you're sending output in /application/controllers/training.php on line one, which means that any script run after that cannot modify the header. Essentially, something is invoking CI's session library in a way which is modifying the header, but the header's been sent. It'd be helpful if we could see line one of training.php.",


More about “Codeigniter header() error” related questions

Codeigniter: Message: Cannot modify header error

This type of question is already asked before Codeigniter: headers already sent error CodeIgniter headers already sent error with different Server Codeigniter - Cannot modify header information -

Show Detail

Codeigniter header() error

I have run into this problem in my Codeigniter app: A PHP Error was encountered Severity: Warning Message: Cannot modify header information - headers already sent by (output started at /application/

Show Detail

Authorization header returns 405 error, React, CodeIgniter

I recently setup a React application with a CodeIgniter backend serving as the API. To use a token pre-set, I setup an axios instance as follows axiosInstance() { const token = this.getWebToke...

Show Detail

Showing header and footer in CodeIgniter custom error pages

In my CodeIgniter folder I have got custom error pages for each type of error in application/views/errors/html like error_404.php etc. So when I tried to update the layout and added <?php $this...

Show Detail

codeigniter template header

Its maybe a redundant question. I try to work with codeigniter. I want my own template with an header used on each page. the header is fill with widgets like a login. I'm walking on internet to f...

Show Detail

Header may not contain NUL bytes Codeigniter

when I do a redirect with Header Location function in PHP or redirect codeigniter function the browser returns this error: Header may not contain NUL bytes How I resolve it? I'm using codeigni...

Show Detail

Codeigniter Load header and footer only once

I'm developing an admin portal using Codeigniter. Here i want to load the header and footer and sidebar only once and change the main content without loading the header and footer everytime. Please

Show Detail

CodeIgniter Common Header Include

I am very new to CodeIgniter, but I think I have a grasp on how it works. Typically when I make a website, like a 5-page site, I have my header file in a php file which is included in each page, s...

Show Detail

Opencart header and Footer Call in Codeigniter Site

I have a site in opencart on root and Codeigniter site in sub-directory. Is there any way to call Opencart Header and Footer in Codeigniter site. Thanks

Show Detail

Getting CodeIgniter to add load->view->header for error fields

How do you get CodeIgniter to load views before it loads the files in application/errors? I have custom error pages but I want them to be displayed beneath the header and menu_bar views.

Show Detail