For reference, I attached README for pgsql session save handler.
It's NOT in 4.2.0-dev, yet.

James Gregory wrote:

> I have need to get php to use postgres to store session information. 
> I've changed the directive in php.ini and written a set of functions 
> that should do the job and I've made the call to set the session 
> handler. The following simple test case works:
> <?
> require_once ('database.php');
> require_once ('sess_handler.php');
> //session_start ();
> session_register ('asdf');
> $asdf = 123;
> print $asdf;
> ?>
> the idea being that the line where $asdf is assigned is commented out in 
> the second execution of it and the value is still there upon reloading.
> That works fine. But, when I try to use it with the code for which it 
> was originally intended I get this error:
> *Fatal error*: Failed to initialize session module in 
> */usr/local/apache/vhosts/600xl/httpdocs/fe_login.php* on line *44*
> Keep in mind that this is all code which worked perfectly with the bulit 
> in session handler before. Any ideas?
> Thanks,
> James.

Yasuo Ohgaki


mod_pgsql is a session save handler module. It provides session strage
with PostgreSQL database. This module is written by [EMAIL PROTECTED] 
Please report problems to or [EMAIL PROTECTED]

Session Table Definition

CREATE TABLE php_sessoin (
  sess_id        char(32) PRIMARY KEY  CHECK strlen(sess_id) = 32,
  sess_name      char(32) NOT NULL,
  sess_created   integer,         -- UNIX time
  sess_modified  integer,         -- UNIX time
  sess_data      text,            -- Max 1GB for 7.1, about 8KB for 7.0 or lower.
  sess_reserved1 integer,
  sess_reserved2 integer,
  sess_reserved3 integer,
  sess_reserved4 integer

User may *append* additional fields, sess_reserved* fields are place
holder for additional feture. Since mod_pgsql accesses field using
field index, user must use this field order.

How to use

To compile PHP with mod_pgsql, you need "--with-session-pgsql[=DIR]"
when you configure PHP. [=DIR] is installation path for
PostgreSQL. You don't have to compile PHP with PostgreSQL module, but
your system must have libpq and headers installed.

Following php.ini directives has special meanings for mod_pgsql

session.save_handler : "pgsql" for mod_pgsql session.
session.save_path    : Valid PostgreSQL database connection string. 

How it works

It uses libpq which is written in C. It also uses aync query for
garbage collection. Therefore, user will not experience deley even if
barbage collection is performed. This module is much more efficient
than user handlers written in PHP.

How to customize

Since mod_pgsql uses PostgreSQL database. User can add more fields to
session database and create session access functions as user
want. Keep in mind that user is not supposed to order of standard
fields. User fields are must be defined after mod_pgsql fields.

PHP General Mailing List (
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to