In order for sessions to work in a multi-server (load-balancing) environment, we must redeclare the session functions to store their information in a MySQL table, rather than the PHP default location (which is a server's /tmp directory).
MySQL tables:
There are two tables that you'll need to create in your MySQL server, if you wish to do user authentication. If you only wish to use the PHP sessions for non-authentication purposes, then you only need to create the first table below:
sessions - this is the table (same as Ying uses) to store the session information.
user_table - this is the table that holds pertinent information about the users (name/pwd/rights)
I've purposefully kept them separate for the reason of allowing multiple people to login under the same credentials. You *can* combine the two tables, and allow only one person to log in to each account at a time, if you so choose. Note as well that the table name "user_track" can be modified to whatever you want (although for the purposes of trying out this code, you might want to stick with it for now).
Ok, so how do I put all this into use?!