Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > HOWTO-Related Questions

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 21st September 2006, 19:42
stormrider stormrider is offline
Junior Member
 
Join Date: Sep 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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!
Reply With Quote
Sponsored Links
  #2  
Old 22nd September 2006, 13:29
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

You could configure your PHP applications to store the sessions in a MySQL database instead of in the file system.
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #3  
Old 22nd September 2006, 13:44
stormrider stormrider is offline
Junior Member
 
Join Date: Sep 2006
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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?
Reply With Quote
  #4  
Old 22nd September 2006, 21:49
Spudchat Spudchat is offline
Member
 
Join Date: Aug 2006
Posts: 32
Thanks: 1
Thanked 1 Time in 1 Post
Default

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
Reply With Quote
  #5  
Old 23rd September 2006, 15:47
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
 
Default

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/
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 02:01.


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