Weird WordPress Session Problem

There’s a feature in PHP called Sessions that allows a bunch of web pages to share the same variables; ordinarily, they’re lost between each page access. This is a cool thing to be able to do, allowing one to create web applications a little more easily. The only reason I know about them at all is because today WordPress wouldn’t let me log in, reporting the following (edited) error:

Warning: session_start(): open(/tmp/sess_xxx, O_RDWR) failed:
Permission denied (13) in /.../wp-hashcash.php on line 22

I checked out the file in question, and it was written by user nobody instead of myself. Therefore, wp-hashcash.php couldn’t start the session, and I got error messages all over the place when I tried to login. I couldn’t do a damn thing.

Then I read in the documentation that sessions were tied into browser cookies, so I looked in my cookie cache and saw an entry called SESSID that matching the file being complained about. I deleted that cookie, and could login again. Problem solved. This cookie contained the session information that was causing PHP to puke, so deleting the cookie forces the session to close.

An annoying but educational detour.