[英]Error 502 Bad Gateway When Using CodeIgniter
The following code is run from my controller and causes a 502 error bad gateway on one server.以下代码从我的 controller 运行,并在一台服务器上导致 502 错误网关错误。 I have been unable to reproduce on my server.
我一直无法在我的服务器上重现。 What are some causes of 502 Bad Gateway?
502 Bad Gateway 的一些原因是什么?
function index()
{
$this->_reload();
}
function _reload($data=array())
{
$person_info = $this->Employee->get_logged_in_employee_info();
$data['cart']=$this->sale_lib->get_cart();
$data['modes']=array('sale'=>$this->lang->line('sales_sale'),'return'=>$this->lang->line('sales_return'));
$data['mode']=$this->sale_lib->get_mode();
$data['items_in_cart'] = $this->sale_lib->get_items_in_cart();
$data['subtotal']=$this->sale_lib->get_subtotal();
$data['taxes']=$this->sale_lib->get_taxes();
$data['total']=$this->sale_lib->get_total();
$data['items_module_allowed'] = $this->Employee->has_permission('items', $person_info->person_id);
$data['comment'] = $this->sale_lib->get_comment();
$data['email_receipt'] = $this->sale_lib->get_email_receipt();
$data['payments_total']=$this->sale_lib->get_payments_total();
$data['amount_due']=$this->sale_lib->get_amount_due();
$data['payments']=$this->sale_lib->get_payments();
$data['payment_options']=array(
$this->lang->line('sales_cash') => $this->lang->line('sales_cash'),
$this->lang->line('sales_check') => $this->lang->line('sales_check'),
$this->lang->line('sales_giftcard') => $this->lang->line('sales_giftcard'),
$this->lang->line('sales_debit') => $this->lang->line('sales_debit'),
$this->lang->line('sales_credit') => $this->lang->line('sales_credit')
);
$customer_id=$this->sale_lib->get_customer();
if($customer_id!=-1)
{
$info=$this->Customer->get_info($customer_id);
$data['customer']=$info->first_name.' '.$info->last_name;
$data['customer_email']=$info->email;
}
$data['payments_cover_total'] = $this->_payments_cover_total();
$this->load->view("sales/register",$data);
}
It seems setcookie was being called too much was caused the 502 error.似乎 setcookie 被调用太多是导致 502 错误。 I am not sure if NGNIX was a limit, but this solved the problem.
我不确定 NGNIX 是否是一个限制,但这解决了问题。
It's an NGINX/CI problem, if you can't change the settings then changing the session to database worked for me这是 NGINX/CI 问题,如果您无法更改设置,那么将 session 更改为数据库对我有用
$config['sess_use_database'] = TRUE;
It could be a buggy Encrypt library.它可能是一个有问题的加密库。 Try setting:
尝试设置:
$config[‘sess_encrypt_cookie’] = FALSE;
http://codeigniter.com/forums/viewthread/103453/#807036 http://codeigniter.com/forums/viewthread/103453/#807036
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.