0

So to start of with I know that using a memcache or a database would be a better way to go. But I have (for now) made a load balance environment where I have a shared PHP session file storage. Some customers now claim they experience some problem and I am not sure if it have anything to do with the session storage.

My question is - how does PHP handle a shared php session file storage? Will there be problems with the session ID's they are given? (since its 3-4 Apache2/PHP machines running creating sessions) How about the clean up when they are marked as garbage? Can one apache2/PHP machine by "accident" delete a session not intended to be deleted yet? All the machines have the same "marked as garbage" timeout. And they all run the same PHP session clean up cronjob.

/Ronnie

Ronnie Jespersen
  • 221
  • 5
  • 13

1 Answers1

0

PHP does not implement "a shared php session file storage?" Do you mean you keep your session files on a network file system? Something else? The default handler uses the file modification time to determine when the session was last accessed. As long as the clocks are nearly in sync (although running ntpd makes more sense) and both are using UTC for the hardware clock then there should be no confusion.

BTW NFS file locking sucks.

symcbean
  • 19,931
  • 1
  • 29
  • 49
  • Yes I have mounted an NFS file storage. This folder is where I keep the PHP sessions for now and that folder is shared between the backends. I know its not the best solution and it is going to be changed. – Ronnie Jespersen May 24 '12 at 10:29
  • Found the issue at hand. The filestorage was old and wasent hooked up on our NTP server. Causing the time to be behind with 40 minutes. – Ronnie Jespersen May 24 '12 at 13:53