Thursday, October 01, 2009

PHP 5.2.10 session ID (sessionId) in URL problem in Solaris (all ZEROes 0000 as the year of the set-cookies)

Wow, I have actually spent 4 hours in looking into what's wrong with this session ID in url problem in a solaris box.

My journey started as turning on all the php log, no luck, nothing in error.log when the problem happened.

Then, I went to play around with all the 0/1 settings in session.* (actually use_only_cookies, use_trans_sid), no luck either.

And then, I went to compare a working windows setup with this solaris setup in php_info()... nothing special there.

I was starting to believe there was something wrong with the cookie, so I tried to use php to setCookie with a timeout. Using the firefox, I found out, the cookie from the solaris apache was not obtained in firefox. Therefore, I started to search google for "apache cookie" and NO, I wasted another hour.

Hmm it seems cookie is actually set in header. Then I used "curl -i" to dump the solaris header, and finally noticed the difference. The year of the expiration date is ALL ZEROes. Confirmed with a cookie WITHOUT timeout, the cookie started to appear in firefox for windows and solaris apache/php.

Googled some more and finally got the correct query: "set-cookie solaris 0000 year", the first result is the answer. Wow, I almost gave up on the way... Created this post for more google result matches.