Nobody could help me???

THX
----- Original Message ----- From: <[EMAIL PROTECTED]>
To: <php-general@lists.php.net>
Sent: Thursday, May 03, 2007 11:45 AM
Subject: [PHP] Custom database session handler and data concurrent access from ajax request



Hi,

i'm currently working on a web site that use AJAX requests to load a web page by part. So, my apache server gives quickly an answer and current client must wait a little bit in order to have the entire web page, but while this loading step,
he can already see my partially displayed web page and use it!

This web site uses php session, based on cookies, but not only cookies (cookies
are just prefered). session.auto_start is false in order to allow object
declarations before session starts (so I can stored little object in session)
There is no session handler defined in php.ini, line has been commented).

In each php script, i start manually the session with session_start and i use register_shutdown to register session_write_close in order to write current
session when the current script is finished.

Sessions are managed in a mysql database, with autocommit enabled. I'm using
mysql_pconnect in my handler to read/write session data (same user, same
password, same host, always).

Read/write session into database works...but not fine.

Scenario: scripts are parts of a main page, scripts are called by ASYNC AJAX GET Script 1 modifies an object A from session and re-serializes it into session, Script 2 is launched when client is receiving a response from the server for
script 1(php output buffering is enabled),
Script 2 displayed object A content from session and flush object A content, re-serializes it into session, but sometime Script 2 doesn't displayed object A modification by script 1. More terrible, reloading the entire page displays all the content of the modified object A (but script 2 has flushed its content!)

I'm asking if custom session handler must implement mutex system or anything to prevent concurrent access and terrible random errors of session writing/reading and more....Concurrent access does'nt seems to be safely managed natively...

Any idea? comment? I can sent my session handler php class....

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to