I moved a database over to another server and setup php and lighttpd, but authentication for my app wasn’t working. After checking, and double checking, I noticed errors showing up in the lighttpd error log.
2009-05-11 01:23:45: (mod_fastcgi.c.2592) FastCGI-stderr: PHP Warning:
Unknown: open(/var/lib/php/session/sess_7u71dlv0a7, O_RDWR) failed:
Permission denied (13) in Unknown on line 0
PHP Warning: Unknown: Failed to write session data (files).
Please verify that the current setting of session.save_path is correct (/var/lib/php/session) in Unknown on line 0
/var/lib/php/session was group owned by apache. Since my lighttpd runs as lighttpd and not as apache, this wouldn’t work. I just changed the ownership to lighttpd, and now my applications can write session files without a problem.
I don’t remember this happening on the original system. Perhaps apache was running here at one point in the past and this is just leftovers? Or perhaps it’s just another one of the generic we-expect-that-you’ll-run-apache configurations that’s usually assumed. I’m tempted to run lighttpd as the apache user.