Devious Malcontent

 Blog Blog RSS

PHP session handling: the new server with an incorrect time zone...

Sunday 18th September 2016

Did I ever talk about the time I was hired to refactor an employee database application for a mid-size organisation? - Well, it's quite the story and something for the grand kids!

It all happened earlier today, while on secondment, - Oh yeah did I tell you that I'm on secondment? I'm currently 3 hours away from home on the other side of the state in Ballarat, about 5 minutes down the road from the IBM offices, for further context I've been set up in some cushy accommodation.

But first, some background on the application, it was made in house with some ancient Microsoft product, no idea what it was called but it only works in Internet Explorer (typical). - so, my job was to rewrite the front end, for all intensive purpose you can think of this system like a simple C.R.U.D system, create, read, update, delete, nothing too fancy, but the legacy code is proving to be a thorn in the side of the organisation who is only expected to grow.

It all started about three weeks ago when I had my first meeting with the client, everyone seems to be very on edge this year and I don't seem to understand why, the world's not gonna end so calm down.

The current instance is running on top of Windows IIS on server 2003, anyway we outlined the form layout, website wireframe, and client side scripting for interactivity, fortunately the database already exists so I don't have to think too hard about the back end side of things, but I did need to implement session handling, time based so if the user is not active on the website for more than X amount of time (an hour for example) the session will expire and the user will be logged out, (always important for something like a corporate system database), anyway it's how I've always programmed websites.

For the clientele there are two people running this project, one, the more senior of the two, seems to be very antsy at the moment, probably something to do with what happened last month back in August with our national census, they are very concerned about the possibility of being attacked by a foreign actor, I've even had to coordinate with the networks team about unwanted packets being received from outside of the country (NK). - the other person in this project who I will refer to as Adam, is a lot cooler, calm and collected, acting as kind of a mentor for me during this project, for simplicity's sake and my own sanity, I tend to coordinate with them a lot more versus the other guy.

I asked the infrastructure team for a test server, what I got was an ancient and unsupported RHEL3 instance, yes, I said that right RHEL3, so it's running some archaic version of PHP, and I'm trying my best to just put up with it, but I eventually turned around to them and say look this isn't gonna work, and I did most of my development on my home system, I spun up a test version of the database, and got to work, for this project I had about three weeks turn around, I was also learning about the continual integration pipeline at this time, (a new concept to me).

Getting back on track to session handling, by almost the end of the third week I had something that I thought was pretty neat, and the meetings with the client were going pretty well (at least the ones were I spoke with Adam directly), going back to the senior one of the two, I'll call him "James", during a test run I showed them the layout for the new website, and the CSS didn't load, I watch James look like he was pulling his hair out, I had to further explain to them what the cause of the issue was and that it was nothing to worry about. - really stressful to be honest. - it was fixed or worked around by loading the site up in a private session, simply a matter of caching.

The next few days after that I was probably ready to go live with not much, if anything left on the project to do.

Finally, I was given access to a new Windows server 2012, this was going to be prod. - I installed a fresh version of XAMPP and deployed my code, this was on Friday, and shortly after that, I have/had a major bug I that I have been trying to solve...

As soon as a user logs in, their session immediately expires and they are logged out again, the logs show nothing out of the ordinary, and finally after many hours of piss-farting around I have an answer.

Since I updated to XAMPP Version 7.0.8 (from version 1.7.3) it never occurred to me that I would need to reset the time zone back to Australian eastern standard time (Australian/Melbourne) as in the newer version of XAMPP it is set to Europe/Berlin by default.

PHP info page of the new server.

PHP info page of the new server.

PHP info page of the old server.

PHP info page of the old server.

See attached screenshots, I actually had to roll back to the old version of XAMPP (as I know my code library that I am referencing works on that setup.)

I cannot express the level of emotions that I went through to solve this problem, and there were times when I felt like giving up. (I really wished I had picked it up sooner, and yes, this part of my post was an extract from an email exchange I had with the client.)

It's one of those things that just comes with experience.

On an unrelated note I also unofficially sat an interview for their web team, so I may be staying around here a bit longer. :)


Home | Blog Index | RSS