1

In the past we used a windows XAMPP server for an internal website. It worked fine but had some intermittent issues and we decided to move to a LAMP server on CentOS.

We made the switch today but it turns out Internet Explorer ignores every attempt I make at saving a cookie. There is no underscore in the URL being used... the URL is actually the same as the one the XAMPP server used, where I was able to save cookies without any problems.

It really doesn't make any sense to me, all of the code is the same. The only thing to change is the version of PHP and the server OS. The website works on all other browsers except IE.

I can't even make a simple setcookie call. On a blank test page I use setcookie("test", "test", time()+36000, "/"); sleep(5); print_r($_COOKIE); and there is nothing there. Our users can't log into the website because of this and I have no idea what the issue is. If anyone can provide any clues or resolutions I would greatly appreciate it.

Obviously the easy answer is to not use IE, but that is not an option in this case.

  • 1
    Alright, I found out what the issue was. The server clock was off by several hours and I believe Internet Explorer strictly enforces the server time. So all of my cookies were immediately expiring. I used this article to correct my server time and everything works perfectly now. http://serverfault.com/questions/368602/how-do-i-update-a-centos-servers-time-from-an-authoritative-time-server – Hussein Sabbagh Oct 18 '13 at 17:08
  • You should add that in as an answer in order to help future users, along with some information to support it. – Magellan Oct 18 '13 at 18:53
  • I tried, but it wont let me for another several hours because I asked the question. – Hussein Sabbagh Oct 18 '13 at 19:07
  • Ah. I forget about that. Looking forward to seeing the answer. – Magellan Oct 18 '13 at 19:08

2 Answers2

1

Alright, I found out what the issue was. The server clock was off by several hours and I believe Internet Explorer strictly enforces the server time. So all of the cookies were immediately expiring.

I used this article to correct my server time and everything works perfectly now.

How do I update a CentOS server's time from an authoritative time server?

0

AFAIK, setcookie sends a header to the page, and usually the page needs to be reloaded again in order for the cookie to be available to the page. Reloading the page also produced this?

Array ()

Or... this may be the issue: https://stackoverflow.com/a/794267

AdyR
  • 109
  • 3