HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   HOWTO-Related Questions (http://www.howtoforge.com/forums/forumdisplay.php?f=2)
-   -   Apache cluster and php sessions (http://www.howtoforge.com/forums/showthread.php?t=7012)

stormrider 21st September 2006 19:42

Apache cluster and php sessions
 
Hello,

I have followed this amazing howto (http://howtoforge.com/high_availabil...apache_cluster) to create my apache cluster. Almost everything seens to be working great (i'm already using unison to sincronyze files :) ).

Then only problem is with php sessions. My users are always losing their sessions because they change servers. How do you solve this? How can i sincro sessions too?

Thanks for any kind of help!

falko 22nd September 2006 13:29

You could configure your PHP applications to store the sessions in a MySQL database instead of in the file system.

stormrider 22nd September 2006 13:44

Is there a simple way to do this? Something like just modifying php.ini or do i have to modify the source of the php script?

Because i have lots of clients that use php and php sessions, so would be impossible to modify all the scripts.

I have seen that php5 on Debian stores its session files in /var/lib/php5/. I tought about mounting this folder using nfs. So the sessions on each server would be synchronized. But them came another questions, i have two servers (server1 and server2) if i mount server1's folder on server2 and server1 goes down, so server2 would lost all sessions and my ha enviroment have a serious point of failure. Any ideas of how to solve this?

Spudchat 22nd September 2006 21:49

I use a setup kind of like yours, instead I have music instead of php sessions. Two machines run apache2, gnump3d, and heartbeat so that if one goes down the second will cover him. Instead of keeping the music locally and using a ton of harddrive space on both machines I use a third machine to export the NFS shares to the servers. For maximum tolerance I would like to add a fourth machine mirroring the NFS server in case it fails. Maybe this will give you some ideas.

Spudchat

falko 23rd September 2006 15:47

Quote:

Originally Posted by stormrider
Is there a simple way to do this? Something like just modifying php.ini or do i have to modify the source of the php script?

This might give you the idea: http://www.devarticles.com/c/a/MySQL...-PHP-Sessions/


All times are GMT +2. The time now is 18:04.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.