php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35152 000 Permission on Session files
Submitted: 2005-11-08 12:21 UTC Modified: 2005-11-16 01:00 UTC
Votes:3
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (33.3%)
From: mhaerry at c3om dot ch Assigned:
Status: No Feedback Package: Session related
PHP Version: 5.0.5 OS: Linux RedHat EL 3
Private report: No CVE-ID: None
 [2005-11-08 12:21 UTC] mhaerry at c3om dot ch
Description:
------------
Since around PHP 5.0.4 we are having a session save problem.

Most of the session files are stored correctly in seperate directories for each virtual host. They have permission of 600 with the owner of the running apache process. But there are from time to time session files which are stored with Permission 000 like:

---
# find <pathtosessiondir> -perm 000 | xargs ls -lh
----------    1 nobody   4294967295        0 Nov  8 05:53 ./<pathtosessiondir>/sess_dc3b60dc98b9ca7beba8f2afdf618df4
----------    1 nobody   4294967295       54 Nov  8 05:50 ./<pathtosessiondir>/sess_122ad7d6c9c627cfa01201c4caf6520d
----------    1 nobody   4294967295       54 Nov  8 05:50 ./<pathtosessiondir>/sess_1939034c40835c4946964eb0af25d14a
----------    1 nobody   4294967295       50 Nov  8 05:37 ./<pathtosessiondir>/sess_353cecf3cd82bdb03092b0ceef89813c
----------    1 nobody   4294967295       54 Nov  8 05:51 ./<pathtosessiondir>/sess_3cfab0c964ce99568520ca002dcdc015
----------    1 nobody   4294967295       54 Nov  8 05:50 ./<pathtosessiondir>/sess_4ecf472d9c094634164ece1fea76bc8f
----------    1 nobody   4294967295       54 Nov  8 05:50 ./<pathtosessiondir>/sess_56bd16f2d97c4705837d88b159df0de6
----------    1 nobody   4294967295       54 Nov  8 05:36 ./<pathtosessiondir>/sess_61d36002c753af2301c361b3247775fa
----------    1 nobody   4294967295       54 Nov  8 05:34 ./<pathtosessiondir>/sess_76e7794ad71b7c7ca30ee14d412d475b

etc.

---

so these session files can't be read anymore by php. it doesn't depend on the application, we have this problem with every application from time to time. and as it works sometimes and sometimes not within the same application we don't think it has something to do with the umask setting. so users can't login anymore etc. one solution is to delete these files as root on the server (manually or in a script). the other is to tell the users to delete the cookies and to restart their browsers. but anyway these are only workarounds which won't fix the problem.

the session dirs aren't in /tmp/ and are also not on a tmpfs filesystem. it's on the normal ext3 filesystem.

any ideas why this can happen and what we can do against that?

Reproduce code:
---------------
standard usage of session functions:

session_start();
$_SESSION['foo'] = 'bar';
[...]

session_destroy(); //while logging out

Expected result:
----------------
expected session files with permission 600

like:

-rw-------    1 nobody   4294967295     215K Nov  8 06:08 sess_9b50bc95e2a138ca376ff0b111d6d5a0

Actual result:
--------------
session files with permission 000:

----------    1 nobody   4294967295       54 Nov  8 05:34 ./<pathtosessiondir>/sess_76e7794ad71b7c7ca30ee14d412d475b

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-08 12:33 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-11-16 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2006-12-01 17:48 UTC] nwallwork at kcp dot com
This seems to be related to bug 28401, which hasn't been fixed.

I experienced a similar problem this week on a CentOS 4.4 host with 
php-5.1.6-1.2.1.centos.i386.rpm
httpd-2.0.52-28.ent.centos4.i386.rpm
subversion-1.3.2-0.1.el4.rf.i386.rpm
Dokuwiki version 2005-07-13

When users accessed subversion through apache, the apache process was creating directories with a umask of 111.  I eventually found that the PHP code for Dokuwiki set a umask of 111 in dokuwiki.php.  This apparently changed the umask for the apache process.

Subversion reported errors:
svn: Can't open file '/usr/local/svn/XXXXXXXX/db/transactions/539-4.txn/node.0.0': Permission denied

Subversion wasn't able to create the new file because the execute bits on the directory weren't set.

The problem was intermittent (presumably related to creating/modifying pages on the wiki), and restarting Apache fixed the problem for a while.

Upgrading to Dokuwiki version 2006-11-06 fixed the problem, because Dokuwiki is aware of this bug and they have worked around it by removing all use of umask().

For reference:
http://wiki.splitbrain.org/wiki:filemodes?s=umask%20chmod
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 13:01:30 2024 UTC