23 February 2013

PITA 6: PHP Warning: Unknown: open(/var/lib/php/session/...., O_RDWR) failed: Permission denied (13) ...

Recently I compiled php 5.3 on my Centos 5.x machine, everything worked fine until I noticed that the HTTP session was not getting created.
I checked the apache error logs and found this php warning getting repeated:
 PHP Warning:  Unknown: open(/var/lib/php/session/...., O_RDWR) failed: Permission denied (13) in Unknown on line 0
I tried to look for the solution on the net, couldn't find a proper solution except someone saying that apache sever should have write access to the session directory (/var/lib/php/session in my case). I did: 
chmod 777 /var/lib/php/session
and restarted the http server, no warning this time in the error logs, everything started working as expected.

My ls -l looks like following:
drwxrwxrwx 2 root apache 270336 Feb 23 14:27 session

No comments:

Post a Comment