CodeIgniter Forums

Full Version: Cookie not being set
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

I am in the process of moving a site from a development environment to a production environment. On the production environment, when I start a session, no cookie is set and I can't seem to figure out why.

--> I am using the standard CI session handling.

Dev works, production does not. Session info is being written to the DB, just no cookie. Any ideas?

I did check phpinfo on the prod. box and sessions are enabled with the usual settings.

From config...

$config['sess_cookie_name'] = 'ci_session';
$config['sess_expiration'] = 1800; // :30
$config['sess_encrypt_cookie'] = TRUE;
$config['sess_use_database'] = TRUE;
$config['sess_table_name'] = 'ci_sessions';
$config['sess_match_ip'] = TRUE;
$config['sess_match_useragent'] = TRUE;

From phpinfo...

Session Support enabled
Registered save handlers files user

Directive Local Value Master Value
session.auto_start Off Off
session.bug_compat_42 On On
session.bug_compat_warn On On
session.cache_expire 180 180
session.cache_limiter nocache nocache
session.cookie_domain no value no value
session.cookie_lifetime 0 0
session.cookie_path / /
session.cookie_secure Off Off
session.entropy_file no value no value
session.entropy_length 0 0
session.gc_divisor 100 100
session.gc_maxlifetime 1440 1440
session.gc_probability 0 0 PHPSESSID PHPSESSID
session.referer_check no value no value
session.save_handler files files
session.save_path /var/lib/php4 /var/lib/php4
session.serialize_handler php php
session.use_cookies On On
session.use_only_cookies Off Off
session.use_trans_sid Off Off

El Forum

Maybe I should rephrase this...what in CI could stop a cookie from being written? Thanks.

El Forum

I actually figured this one out myself. The issue in this case, for me was that the server time was behind my client time by enough seconds to cause the browser to reject/delete my cookie at the time it was set.