Warning: session_start(): Cannot send session cache limiter – headers already sent!!! Again – Codeigniter hacks


The same cache limiter problem this time in Codeigniter, if you have this kind of error you should change the redirect function with this one.

if ( ! function_exists('redirect'))
{
function redirect($uri = '', $method = 'location', $http_response_code = 302)
{
ob_start(); //new code
if ( ! preg_match('#^https?://#i', $uri))
{
$uri = site_url($uri);
}

switch($method)
{
case 'refresh' : header("Refresh:0;url=".$uri);
break;
default : header("Location: ".$uri, TRUE, $http_response_code);
break;
}
ob_end_clean(); //new code
exit;
}
}

Advertisements

Tags: , , , , , ,

One response to “Warning: session_start(): Cannot send session cache limiter – headers already sent!!! Again – Codeigniter hacks”

  1. Muhammed Shihabudeen Labba says :

    Open the file mentioned in the ‘message’ part in Notepad++. Select tab: Encoding -> Encoding in UTF-8 without BOM.

    Save the file, enjoy!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: