|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-02-27 10:56 UTC] 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"
PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 18:00:01 2025 UTC |
It seems this is some kind of permission issue, but Re-Opened because reporter has this issue still. Those who have this issue, please check session data file owner/group of processes trying to write/read session data file. i.e. sess_{session_id} in session.save_path. It MUST match and it must not be root for many setups.