My web application develop using CodeIgniter 1.7 is having error ERR_RESPONSE_HEADERS_TOO_BIG when open with Chrome browser only. I tried with all other browser the error will not happen.
I can open the page normally after i refresh the error page. I try search from Google, it seems this bug happen to Chrome user since 2009 until now.
This is my controller code:
function search_daily_sales_summary_view()
{
if(!($this->session->userdata('DAILY_SALES_SUMMARY'))){
$this->session->set_flashdata('error', 'You dont have the permission to access that page.');
redirect('login/home');
}
$this->load->model('currency_model');
$this->load->model('bill_model');
$data = array();
$report = array();
if($query = $this->currency_model->list_currency())
{
foreach ($query as $row) {
$currencyid = $row->CURRENCY_ID;
$currencycode = $row->CURRENCY_CODE;
if($buyData = $this->bill_model->calculate_buy($currencyid))
{
$totalbuy = $buyData->total_from_amount;
$totalbuy_rate = $buyData->rate;
if($buyData->total_from_amount=='')
{
$totalbuy = 0.00;
}
if($buyData->rate=='')
{
$totalbuy_rate = 0.00;
}
}
else
{
$totalbuy = 0.00;
$totalbuy_rate = 0.00;
}
if($sellData = $this->bill_model->calculate_sell($currencyid))
{
$totalsell = $sellData->total_from_amount;
$totalsell_rate = $sellData->rate;
if($sellData->total_from_amount=='')
{
$totalsell = 0.00;
}
if($sellData->rate=='')
{
$totalsell_rate = 0.00;
}
}
else
{
$totalsell = 0.00;
$totalsell_rate = 0.00;
}
$report[] = array("currency"=>$currencycode, "buy"=>$totalbuy, "buyrate"=>$totalbuy_rate, "sell"=>$totalsell, "sellrate"=>$totalsell_rate);
}
$data['records'] = $report;
}
$this->load->model('company_model');
if($query = $this->company_model->list_company())
{
$data['company_list'] = $query;
}
$this->load->model('branch_model');
if($this->input->post('company'))
{
$companyid = $this->input->post('company');
if($query = $this->branch_model->view_company_branch($companyid))
{
$data['branch_list'] = $query;
}
}
else
{
if($query = $this->branch_model->list_branch())
{
$data['branch_list'] = $query;
}
}
$this->load->view('report/daily_sales_summary', $data);
}
How to solve this?
CI stores sessions in a cookie. If you store too much in a cookie, you get errors.
Set CodeIgniter to use DB sessions instead, or save this to a file.
Saving Session Data to a Database
CREATE TABLE IF NOT EXISTS `ci_sessions` (
session_id varchar(40) DEFAULT '0' NOT NULL,
ip_address varchar(16) DEFAULT '0' NOT NULL,
user_agent varchar(120) NOT NULL,
last_activity int(10) unsigned DEFAULT 0 NOT NULL,
user_data text NOT NULL,
PRIMARY KEY (session_id),
KEY `last_activity_idx` (`last_activity`)
);
Note: By default the table is called ci_sessions, but you can name it anything you want as long as you update the application/config/config.php file so that it contains the name you have chosen. Once you have created your database table you can enable the database option in your config.php file as follows:
$config['sess_use_database'] = TRUE;
Once enabled, the Session class will store session data in the DB.
Make sure you've specified the table name in your config file as well:
$config['sess_table_name'] = 'ci_sessions';
Note: The Session class has built-in garbage collection which clears out expired sessions so you do not need to write your own routine to do it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With