I’m experiencing a highly annoying PHP sessions bug (PHP bug 32330). By simply trying to start a session with session_start(), at seemingly random times I get a session_start(): Failed to initialize storage module: error.
The PHP bug 32897, is actually more accurate in my case, but that one’s been closed as a duplicate.
The bug has been open since October 2003, and is probably still there because it’s so difficult to duplicate. The server I’m experiencing it on has all sorts of other junk on it. Someone said they started experiencing it after installing OSCommerce, which does exist on this server too.
If somebody does come across this post looking for help, there’s a thread over at mamboserver.com that is helpful for newbies in getting session.save_handler set to FILES, not USER, the most common cause of the problem.
But sadly that’s not my problem. Can anyone shed some more light on this?
Are you starting sessions automatically when a page view is started?
No, I explicitly call session_start(). I’ve ended up explicitly calling both:
ini_set(“session.save_handler”, “files”);
and
ini_set(“session.save_path”, “/tmp”);
and this seems to have helped. I can only guess that something somewhere tricks PHP into thinking it’s USER and not FILES, even though this is not in php.ini, nor in any of my code. Perhaps oscommerce is worth investigating as a culprit, but for now I’m just happy to have got it, touch wood, working.