|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
  [2014-09-12 20:44 UTC] rmoisto at gmail dot com
 Description: ------------ I have a tiny cli script that accepts a session id as a command line argument. It's job is to fetch that session and print it out. Since upgrading to PHP 5.5.16 the $_SESSION variable is always empty. It did work before. Test script: --------------- <?php session_id($argv[1]); session_start(); var_dump($_SESSION); Expected result: ---------------- $_SESSION is an array filled with session information. Actual result: -------------- $_SESSION is an empty array. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             | |||||||||||||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 17:00:02 2025 UTC | 
It seems working now. Do you still have this issue? [yohgaki@dev PHP-5.5]$ cat t1.php <?php session_id($argv[1]); session_start(); var_dump($_SESSION); $_SESSION['test']=time(); [yohgaki@dev PHP-5.5]$ ./php-bin -d session.use_strice_mode=0 t1.php 21345 array(1) { ["test"]=> int(1422934949) } [yohgaki@dev PHP-5.5]$ ./php-bin -d session.use_strice_mode=0 t1.php 21345 array(1) { ["test"]=> int(1422934964) }The problem is still present. Output of "php -v": PHP 5.5.18-1+deb.sury.org~precise+1 (cli) (built: Oct 17 2014 15:11:34) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies I've updated my test script: <?php session_id($argv[1]); session_start(); echo file_get_contents('/var/lib/php5/sessions/sess_' . $argv[1]) . PHP_EOL; var_dump($_SESSION); var_dump(session_id()); var_dump(session_save_path()); Which outputs: (actual data in the session file, too much of it to paste here) array(0) { } string(26) "l8lrlpo9t36guik6m8h04lnaa6" string(22) "/var/lib/php5/sessions" The assumption that a CLI script is filling the session is false. It is filled by fpm that is used by the web server (nginx).