PHP 4.0 Bug #6157: Sessions not working -- problem with files
| From: | vaughan at ucla dot edu | Date: | Mon, 14 Aug 2000 21:05:46 +0000 |
| Subject: | PHP 4.0 Bug #6157: Sessions not working -- problem with files | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-28858@lists.php.net to get a copy of this message | ||
From: vaughan@ucla.edu
Operating system: Linux 2.2.14
PHP version: 4.0.1pl2
PHP Bug Type: Session related
Bug description: Sessions not working -- problem with files
page1.php
<?php
session_start();
session_register("my_var");
$my_var="test";
echo $my_var;
?>
page2.php
<?php
session_start();
$a=session_is_registered("my_var");
echo "a has value $a";
echo $my_var;
?>
page1.php produces the expected output: test.
page2.php produces:
a has value
so the session is not working.
track_vars is enabled, register_globals is enabled.
php.ini file [sessions]
[Session]
session.save_handler = files ; handler used to store/retrieve data
session.save_path = /phpsessions ; argument passed to save_handler
; in the case of files, this is the
; path where data files are stored
session.use_cookies = 1 ; whether to use cookies
:
session.name = PHPSESSID ; name of the session
; is used as cookie name
session.auto_start = 0 ; initialize session on request startup
session.cookie_lifetime = 0 ; lifetime in seconds of cookie
; or if 0, until browser is restarted
session.cookie_path = / ; the path the cookie is valid for
session.cookie_domain = ; the domain the cookie is valid for
session.serialize_handler = php ; handler used to serialize data
; php is the standard serializer of PHP
session.gc_probability = 1 ; procentual probability that the
; 'garbage collection' process is started
; on every session initialization
session.gc_maxlifetime = 1440 ; after this number of seconds, stored
; data will be seen as 'garbage' and
; cleaned up by the gc process
session.extern_referer_check = ;
session.entropy_file = ;
session.entropy_length = 0 ;
the directory /phpsessions
is owned by the process that is running apache.
the directory contains files with names like this:
sess_7ec31a321f14710b8f6f96be239e0a2c
but they are empty (recorded as 0 bytes).
and the apache error log contains the following (which looks like it might have been output by php):
<b>Warning</b>: write failed: Bad file descriptor (9) in <b>Unknown</b> on
line
<b>0</b><br>
<b>Warning</b>: Failed to write session data. Please check that the current set
ting of session.save_path is correct (/phpsessions) in <b>Unknown</b> on line <b
>0</b><br>
<br>
Apache version: 1.3.12
Debian Linux 2.2.13ac2 #1
loaded modules:
mod_php4, mod_setenvif, mod_unique_id, mod_expires,
mod_auth, mod_access, mod_rewrite, mod_alias,
mod_userdir, mod_cgi, mod_dir, mod_autoindex, mod_status,
mod_negotiation, mod_mime, mod_log_config, mod_macro,
mod_so, http_core
I have tried changing the session_save_handler to the same name as the owner of the apache process,
but it makes no difference.
Sessions were working just fine in the previous release of version 4 of PHP.