PHP Cookies/Sessions failing to set in Internet Explorer/Firefox

I discovered while testing a locally hosted site that in Chrome my sessions were working correctly but in the IE and Firefox my session cookies were failing to be set. After some research I discovered that IE/FF were having trouble with the domain of which the cookie was set to use. I’d forgotten that a while back I’d changed PHP’s ‘cookie_domain’ to a specific domain to allow me to test sub-domains and such, this meant that IE and FF were failing to accept the cookie whereas Chrome was a little more accepting for cookies it figured were from localhost. All is needed is for you to set the ‘cookie_domain’ in the php.ini to ‘false’, ‘null’ or ” in order to accept cookies from localhost correctly. See http://www.php.net/manual/en/session.configuration.php#ini.session.cookie-domain for more information.

Advertisements

Published by:

Skyrail

Production Facilitator at Audacious Church Previously Software Developer at UKFast Ltd. and Web Applications Developer at SenseLogix Ltd. Graduate of Renewable Energy BSc from the University of Exeter. Experience with PHP, MySQL, Javascript, CSS and HTML.

Categories PHP, ProgrammingTags Leave a comment

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