php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6157 Sessions not working -- problem with files
Submitted: 2000-08-14 17:05 UTC Modified: 2000-08-17 16:30 UTC
From: vaughan at ucla dot edu Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.1pl2 OS: Linux 2.2.14
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: vaughan at ucla dot edu
New email:
PHP Version: OS:

 

 [2000-08-14 17:05 UTC] vaughan at ucla dot edu
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.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-17 16:30 UTC] sas@php.net
This problem was caused by a bug in the Apache SAPI module which has been fixed. Thanks for your report. Until PHP 4.0.2, you might want to use a snapshot:

http://snaps.php.net/
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon May 12 00:01:27 2025 UTC