[PHP-DEV] Serious Session Handler Problem From: Tim Parkin (Tim.Parkin <email protected>)
Date: 10/26/00

Hi,

I was hoping someone from the PHP team could respond to this.

I am having major problems getting a custom session handler (oci8 based) to
work in php-4.0.2 and php-4.0.3. I have set session.save_handler=user in the
php.ini file and it registers in phpinfo(). I have also set the module_name
specifically using :

session_module_name('user');

The problem is that the write function does not work. I have seen many posts
showing thae same problem (admittedly some of them are a result of not
setting save_handler) and as yet have found no 'official' response.

This seems to have been around since 4.0.1pl2.

I have tried printing from the write function and also writing to a file
whilst presuming that the session write is not called till after the page
has finished processing.

This is a major blow to a project we are working on. We can find ways around
this but it has knocked our confidence in PHP somewhat.

A prompt reply would be greatly appreciated.

dev environment

Sun Sparce Ultra 5

Solaris 8

APACHE-1.3.12
./configure --with-layout=Apache --prefix=/usr/local/apache
--enable-module=so --enable-module=rewrite --enable-module=log_referer
--enable-module=info --enable-module=status
--add-module=src/modules/standard/mod_rewrite.c
--add-module=src/modules/standard/mod_log_referer.c
--add-module=src/modules/standard/mod_info.c
--add-module=src/modules/standard/mod_status.c --enable-shared=max
--server-uid=oracle --server-gid=dba

PHP-4.0.2
./configure --with-apxs=/usr/local/apache/bin/apxs --enable-track-vars=yes
--enable-bcmatch=yes --enable-memory-limit=yes --enable-magic-quotes=yes
--enable-trans-sid=yes --enable-nodebug=yes
--with-oci8=$ORACLE_HOME/lib--with-oracle=$ORACLE_HOME/lib --without-mysql
--enable-libgcc

Tim Parkin
Web Development Manager
Didio Communications

oci_session_handler is avaialable on request although the normal test
handler fails to
write also ie..

<?php
function open ($save_path, $session_name) {
echo "open ($save_path, $session_name)\n";
return true;
}
function close () {
echo "close\n";
return true;
}
function read ($key) {
echo "read ($key)\n";
return "foo|i:1;";
}
function write ($key, $val) {
echo "write ($key, $val)\n";
// Test to see if output to page is failing due to write being executed
after user output
is finished
$fp = fopen("temp",w);
fwrite($fp,"write ($key, $val)",4096);
fclose($fp);
return true;
}
function destroy ($key) {
return true;
}
function gc ($maxlifetime) {
return true;
}

session_set_save_handler ("open", "close", "read",
"write", "destroy", "gc");
?>

Thanks

php.ini

;;;;;;;;;;;;;;;;;
; Data Handling ;
;;;;;;;;;;;;;;;;;
variables_order = "EGPCS"
register_globals = On
register_argc_argv = On
track_vars = On
gpc_order = "GPC"
; Magic quotes
magic_quotes_gpc = On
magic_quotes_runtime = On
magic_quotes_sybase = Off

; automatically add files before or after any PHP document
auto_prepend_file =
auto_append_file =