Hello in my codeigniter I have created table as ci_sessions with following fields
CREATE TABLE IF NOT EXISTS `ci_sessions` (
session_id varchar(40) DEFAULT '0' NOT NULL,
ip_address varchar(45) 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`)
);
Every field is working fine, except ip address which is storing as 0.0.0.0 for every client. I have edited my config.php as below.
$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 7200;
$config['sess_expire_on_close'] = FALSE;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = TRUE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update'] = 300;
With Linode your app is likely behind a proxy. You can either find out your proxy IP and add it to the whitelist in your CodeIgniter config file (bottom of
/application/config/config.php
), or follow the directions on Linode's Nodebalancer Reference for using the Apachemod_rpaf
module to remap X_FORWARDED_FOR to REMOTE_ADDR.