• PHP
  • Ruby on Rails
  • MySQL
  • Linux
    • SELINUX
    • Fedora
    • debian
  • Apache
  • nginx
  • AJAX
Albertech.net

Tag Archives: Gmt

PHP: Cookies expiring too early in Safari (Win)

October 9, 2009 3:36 pm / Albertech.net

There appears to be an issue with cookies on Windows Safari that expires  at UTC time and not according to the time zone on your machine.

I tested my PHP code

setcookie("mycookie", $sample_session_variable, time()+10000,'/mydirectory/','mysite.com');

I verified that the cookie expires at the correct time for the following browsers

  • Firefox 3.5
  • Internet Explorer 8
  • Safari (Apple OS X)

However,  Safari 4 (Windows) have cookies are expiring at UTC time.

So if you have are using PHP cookies (or any other scripting language) and they don’t work in Safari, the cause may be the expiration date.

If you plan to have you cookies expiring after more that 24 hours, its not an issue. Its best to set the time() + value to 86400 at the very minimum. This is to ensure Safari (Win) users will have functioning cookies.

setcookie("mycookie", $sample_session_variable, time()+86400,'/mydirectory/','mysite.com');

Share this:

  • Facebook
  • Google
  • Twitter
  • Print
  • Email
Posted in: PHP / Tagged: cookies, GMT, Safari, UTC, Windows

Categories

  • AJAX
  • Android
  • Apache
  • Canon Cameras
  • Cloud
  • CMS
  • Computer Mods
  • Conferences
  • Deals
  • debian
  • Fedora
  • Flash
  • Frameworks
  • git
  • Hardware
  • HTML
  • IDE
  • iPhone
  • iPhone App Review
  • jQuery
  • Linux
  • Mac OS X
  • MySQL
  • nginx
  • PHP
  • portfolio
  • Puppet
  • Ruby on Rails
  • Script Reviews
  • SELINUX
  • Software
  • Software Review
  • SQL Server
  • statistics
  • Tech
  • Tomcat
  • Uncategorized
  • VMWARE
  • VPS
  • Windows
  • wordpress
  • Zend Framework

Blogroll

  • DragonAl Flickr
  • Dropbox – Free 2GB Account
  • James' Blog
  • Javascript Compressor
  • PHP Builder Community
  • PHP-Princess.net
  • Rubular – Regular Expression Validator
  • The Scale-Out Blog
  • Tiny MCE

Tags

activation AJAX android antec Apache AWS awstats canon coda codeigniter debian enclosure external free G1 install vmware tools Internet Explorer iphone 5 jquery Linux mx-1 MySQL office 2007 OSX photoshop PHP plugin plugins portfolio redesigned website review rewrite script security SELinux ssh tinymce tutorial upgrade VMWARE vmware server wordpress wordpress mu XSS zend framework
© Copyright 2013 Albertech.net
Infinity Theme by DesignCoral / WordPress
loading Cancel
Post was not sent - check your email addresses!
Email check failed, please try again
Sorry, your blog cannot share posts by email.