Edit report at https://bugs.php.net/bug.php?id=69136&edit=1
ID: 69136
Updated by: yohgaki@php.net
Reported by: maggus dot staab at googlemail dot com
Summary: Session file empty when session-path on NFS mount
Status: Open
Type: Bug
Package: Session related
Operating System: Ubuntu 14 LTS
PHP Version: 5.6.6
-Assigned To:
+Assigned To: yohgaki
Block user comment: N
Private report: N
New Comment:
Locking under shared directory is unreliable. I guess this is the reason why.
Better approach to share sessions across servers is to use databases/caches like
memcached/mongodb/redis/etc.
Anyway, I may look into details...
Previous Comments:
------------------------------------------------------------------------
[2015-02-27 11:08:28] me at kelunik dot com
Same thing happens with a NTFS partition mounted with under Ubuntu 14.10
ntfs defaults,umask=0000,permissions,uid=1000 0 0.
------------------------------------------------------------------------
[2015-02-27 10:59:29] maggus dot staab at googlemail dot com
1) I dont understand why the session cannot be written, since I checked is_dir, is_writable and
is_readable beforehand. Even setting the dir to "0777" makes it work.
2) when basic things like writing a session doesnt work, I would expect a ERROR instead of a WARNING
------------------------------------------------------------------------
[2015-02-27 10:56:47] maggus dot staab at googlemail dot com
Description:
------------
php -v
PHP 5.6.5-1+deb.sury.org~trusty+1
Test script:
---------------
<?php
$path = '/path/to/a/dir/mounted/via/nfs/';
if (!is_dir($path) || !is_writable($path) || !is_readable($path)) {
throw new Exception("$path is not a proper dir");
}
//ini_set("session.save_path", $path); // neither this works
session_save_path($path); // nor this does
session_start();
$_SESSION['cnt'] = $_SESSION['cnt']+1;
var_dump($_SESSION['cnt']);
if ($_SESSION['cnt'] > 1) {
echo "<h1>WORKS</h1>";
session_destroy();
}
exit();
Expected result:
----------------
on each 2nd request "WORKS" is printed.
Actual result:
--------------
session is not persisted. session file gets created but does not contain any content. therefore
subsequent calls will never echo "WORKS" because session cannot be continued.
with default Ubuntu php.ini a error/warning doesnt show up at all.
After adding
ini_set("display_errors", "On");
error_reporting(E_ALL);
I get a warning
"Warning: Unknown: Failed to write session data (files). Please verify that the current setting
of session.save_path is correct (/XX..ZZ..YY/tmp/www/session/) in Unknown on line 0"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69136&edit=1