Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manage a single PHP5 session on multiple apache servers?

Hi I have to retrieve data from several web servers. First I login as a user to my web site. After successfull login I have to fetch data from different web servers and display. How can I share a single session with multiple servers. How can I achieve this?

When I first login it create session and session id saved on temp folder of that server. When I try to access another server how can I use current session that already created when I logged in. Can anybody suggest a solution?

like image 341
learner Avatar asked Jun 27 '11 09:06

learner


People also ask

How do I maintain a session on multiple servers?

If you are deploying application on more than one server, you should use "Clustering". Application servers are able to handle this scenario using "session replication". With session replication, each server will have a copy of the active users session.

How many sessions can PHP handle?

1000+ sessions can still be perfectly handled by standard PHP file based sessions. If you notice that is getting a problem, you can exchange the session backend easily. There are pluggable session handlers for memcached or other memory or database based storage systems.

Is PHP session server side?

Yes, the session data is on the server only.

Does PHP support session management?

PHP's session manager is adaptive by default currently. An adaptive session manager bears additional risks. When session. use_strict_mode is enabled, and the session save handler supports it, an uninitialized session ID is rejected and a new one is created.


1 Answers

You'll have to use another session handler.

You can:

  • build your own (see session_set_save_handler) or
  • use extensions that provide their own session handler, like memcached
like image 170
Artefacto Avatar answered Sep 19 '22 12:09

Artefacto