Working here and with IRC #php, so will try to answer all the Q's and add some more info I found:
Am I on a shared web server?
No 1.) Dev box is SO (Stand-alone) WAMP DT box, 2.) Test box is SO Ubuntu Server 7.10, 3.) Prod box is RHE4. All dedicated boxes housed at site warehouse.
Do sessions work at all or do they work but are ending after a short time?
Sessions work for about 15-30 minutes, but then go out.
What exactly are the symptoms?
Even though sessions are working vars are not holding or passing from page to page. Doing "var_dump" on dev box show all vars and values including the basket, but not passing to the "basket.php" file. On Test box the "var_dump" shows only a minimal set of vars and all shopping cart basket vars are empty.
I've saved the screens, in both the states (toggling my checkbox) and from both the DT dev box and remote test box, to help you see my problem. First file has screens. Second file has the images.
What are the settings for GC frequency in php.ini?
Changed order as follows to sync settings on Dev DT and Test box.
; variables_order = "EGPCS"
variables_order = "GPCS"
Found no frequency setting for these but found
max_execution_time = 30
so assume sessions blow after 30 minutes, which is about when all is lost.
Comments from LostBoy on Sessions Table:
Its pretty simple and it should handle the time outs. I would approach this by creating a session table
record_id PK autonumber
user_hash user_id + current login timestamp to allow for multiple user records (unless you want to make a separate date field)
session_data (either 1 field packed separated by some delimiter or multiple fields, its up to you)
Then with each request, set the user_hash as a hidden field in the form or attached to the GET url in a link
When the data comes back, look up the user based on the hash value and pull the session data out for validation
Then generate the results adding the hash back into the page as above
I generated the following SQL:
-- phpMyAdmin SQL Dump
-- version 2.11.6
-- Host: localhost
-- Generation Time: Nov 18, 2008 at 01:36 PM
-- Server version: 5.0.51
-- PHP Version: 5.2.6
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
-- Database: `whse`
-- Table structure for table `session_trap`
DROP TABLE IF EXISTS `session_trap`;
CREATE TABLE IF NOT EXISTS `session_trap` (
`s_id` int(11) NOT NULL auto_increment COMMENT 'Session Unique Record',
`s_sid` varchar(40) NOT NULL default '' COMMENT 'Session ID',
`s_name` varchar(40) NOT NULL default '' COMMENT 'Session Name',
`s_uid` varchar(40) NOT NULL default '' COMMENT 'Session UserID',
`s_uhs` varchar(40) NOT NULL default '' COMMENT 'Session UserID hash',
PRIMARY KEY (`s_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
I know it's not complete, but a start, so chime in on what else you think I need here. Also am thinking of creating a "basket" table so all the shopping cart info goes there, then this will hold the info, even if the customer logs out and then returns.
One of the scenarios I deal with, is the site has a printable order sheet, so customers come to the site, login, print the order sheet, go to their warehouse, hand write onto the printed order sheet, then come back to site to order. This process can span several hours, as most have large warehouses, with hundreds of the site products on their shelves.
Thinking about my code, I have some changes to make this morning, will see what those do and get back to you here.