I’m migrating a PHP 4 site right now. It makes me realize how far PHP has come in the last few years.

I ran across a weird bug where code was working on our dev server, but not production. I was getting the error:

session_start(): Failed to initialize storage module

We’re using memcache to store our sessions, so it’s a user storage module.

Luckily, I stumbled across this helpful post. [edit: I only checked the page on our production box directly (not going through the load balancer) after I made this change, so it seemed to fix the problem, but the issue was really caused by the fact that I wasn’t defining the custom session handler when it was hit by the LB]

Long story short, make sure you actually have the session directory created, even if you’re not using it. In our case, it was /tmp/sessions. Check your php.ini for “session.save_path.”

To be honest, I’m not sure why it was set up that way, but it was, and it was a pain in the ass to figure out. Nothing like a Fatal Error when you push up your code…

Edit: We actually had an additional issue that I didn’t realize - I had returned out of our custom session handler when it was hit by the load balancer. It wasn’t able to use the user defined session handler (because I never defined it) and had the fatal error as a result.