Issues with PHP 5.3 and sessions folder

后端 未结 4 745
一整个雨季
一整个雨季 2020-11-29 18:10

I recently upgraded to PHP 5.3 and since then I get (sporadic) error messages which indicate Apache (or may be the cleaner of the session files) has no permissions to the fo

4条回答
  •  没有蜡笔的小新
    2020-11-29 18:38

    This seems to be a typical error on Ubuntu servers (I'm using Lucid LTS). The default permissions of the /var/lib/php5 directory there are

    drwx-wx-wt  2 root     root     4096 2011-11-04 02:09 php5
    

    so it can be written but not read by the web server, I guess that explains the errors.

    As Ubuntu has it's own garbage cleaning via cron (/etc/cron.d/php5), it's probably best to disable php's garbage collection as suggested above by Diwant Vaidya.

    session.gc_probability = 0
    

    There's actually a reason the session folder should not be world readable - as the PHP Manual says:

    If you leave this set to a world-readable directory, such as /tmp (the default), other users on the server may be able to hijack sessions by getting the list of files in that directory.

提交回复
热议问题