php session name and session id conflicts across sites
I invoked session_start() from a page in account web.uvic.ca/alpha in tab A of my browser, and then invoked session_start() from a page in account web.uvic.ca/bravo in tab B of my browser, the server assumes I want to use the same session file. This appears to be the case even if I close tab A before opening tab B (but leave the browser window open).
The problem is that the owner of the session file created on the server is "alpha", so when "bravo" tries to write (or maybe read) that file, the server throws the errors:
Warning: Unknown(): open(/tmp/php/session/sess_5UbiYj4KYah8g1d8wfS0w2,
O_RDWR) failed: Permission denied (13) in Unknown on line 0
Warning: Unknown(): Failed to write session data (files). Please verify
that the current setting of session.save_path is correct
(/tmp/php/session) in Unknown on line 0.
If I precede the first invocation of session_start on site alpha with something like:
session_name('sitealpha');
session_id('sitealpha' . time());
and precede each subsequent invocation of session_start() with
session_name('sitealpha');
and do similar on bravo, then the pages work and no errors appear. Presumably by explicitly specifying the session name and id, I'm creating a unique session file from each site, with the appropriate owner.
I suspect I could get away without the session_id call, but I haven't tested that.