What are the best methods for storing PHP session data in a database?

I developed a web application that uses a web server and a database hosted on a website (locally) and a server running on Amazon Web Services EC2. Both servers can be used by the user during the session, and both must know the user's session information. I do not want to receive the information necessary for both servers, because I do not want it to be visible to browsers / Firebug, etc. Therefore, I need my session data to be stored on different servers. And I think this means that the best option is to store all / some of the data that I need in the database, and not in the session. The easiest way to do this is to save the sessions, but POST the session_id between the servers and use this as a key to find the data that I need from the user_session_data table in the database.

I looked at Tony Marston’s article “ Saving PHP Session Data in a Database ” - should I use this or a table with the data session that I need, and session_id as a key is enough? What would be the disadvantage of creating my own table and the set of methods for storing the data that I need in the database?

+5
source share
1 answer

If the exchange rate and response time between EC2 and the database server are good enough, I see no problems with storing session data, as described, and passing session_id when transferring the user to another server.

-

. " " - . - PHP, - .

+2

All Articles