<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >PostgreSQL Session Save Handler</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Manual do PHP" HREF="index.html"><LINK REL="UP" TITLE="Referência das Funções" HREF="funcref.html"><LINK REL="PREVIOUS" TITLE="sesam_settransaction" HREF="function.sesam-settransaction.html"><LINK REL="NEXT" TITLE="session_pgsql_add_error" HREF="function.session-pgsql-add-error.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="reference" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Manual do PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.sesam-settransaction.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.session-pgsql-add-error.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="reference" ><A NAME="ref.session-pgsql" ></A ><DIV CLASS="TITLEPAGE" ><H1 CLASS="title" >CXLVIII. PostgreSQL Session Save Handler</H1 ><DIV CLASS="PARTINTRO" ><A NAME="AEN202776" ></A ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="session-pgsql.intro" >Introdução</A ></H1 ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B >Esta extensão não está disponível na plataforma Windows.</P ></BLOCKQUOTE ></DIV ><P > This module provides an additional session save handler for the <A HREF="ref.session.html" >session</A > module using <A HREF="http://www.postgresql.org/" TARGET="_top" >PostgreSQL</A > as a storage system. A <TT CLASS="literal" >user-level</TT > session storage function may also be used - <A HREF="function.session-set-save-handler.html" ><B CLASS="function" >session_set_save_handler()</B ></A >, but this module is written in C and therefore could be twice as fast, compared to a session save handler written in PHP. </P ><P > Session PgSQL is designed to scale any size of web sites and offers some advanced features: <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD >session tables are created automatically</TD ></TR ><TR ><TD >automatic session table vacuum</TD ></TR ><TR ><TD >better garbage collection</TD ></TR ><TR ><TD >multiple PostgreSQL servers support</TD ></TR ><TR ><TD >automatic database server failover (switching)</TD ></TR ><TR ><TD > automatic database server load balancing if there are multiple PostgreSQL servers. </TD ></TR ><TR ><TD >short circuit UPDATE</TD ></TR ></TBODY ></TABLE ><P ></P > </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="session-pgsql.requirements" >Dependências</A ></H1 ><P > You need at least PHP >= 4.3.0, and PostgreSQL >=7.2.0 as database server. <TT CLASS="literal" >libpq</TT > that comes with PostgreSQL 7.2.0 or later (and header files to build) and <A HREF="http://www.ossp.org/pkg/lib/mm/" TARGET="_top" >libmm</A > (and header files). </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="session-pgsql.installation" >Instalação</A ></H1 ><P > Short installation note: <P ></P ><UL ><LI ><P > Untar the <TT CLASS="literal" >tar.gz</TT > archive into <TT CLASS="filename" >php4/ext</TT > (Latest official releases can be found at SourceForge <A HREF="http://sourceforge.net/projects/phpform-ext/" TARGET="_top" >PHP Form Extension Project</A >) </P ></LI ><LI ><P > If the new directory is now called something like <TT CLASS="literal" >session_pgsql</TT >. You should name it to <TT CLASS="literal" >session_pgsql</TT > (except you only want to build it as self-contained php-module). </P ></LI ><LI ><P >Run <KBD CLASS="userinput" >./buildconf</KBD > in php4</P ></LI ><LI ><P > Run <KBD CLASS="userinput" >configure</KBD > <CODE CLASS="option" >--with-session-pgsql</CODE > (and your other options) </P ></LI ><LI ><P ><KBD CLASS="userinput" >make; make install</KBD ></P ></LI ></UL > </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="session-pgsql.configuration" >Configurações em execução</A ></H1 ><P > O comportamento dessas funções podem ser modificado pelas configurações do <TT CLASS="filename" >php.ini</TT >. </P ><P > PostgreSQL session save handler is still under development. Refer to the <TT CLASS="filename" >README</TT > file in the source distribution for configuration details. </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="session-pgsql.tables" >Table definitions</A ></H1 ><P >Session table definition <TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="sql" >CREATE TABLE php_session ( sess_id text, sess_name text, sess_data text, sess_created integer, sess_modified integer, sess_expire integer, sess_addr_created text, sess_addr_modified text, sess_counter integer, sess_error integer, sess_warning integer, sess_notice integer, sess_err_message text, sess_custom text ); CREATE INDEX php_session_idx ON php_session USING BTREE (sess_id);</PRE ></TD ></TR ></TABLE > </P ><DIV CLASS="warning" ><P ></P ><TABLE CLASS="warning" BORDER="1" WIDTH="100%" ><TR ><TD ALIGN="CENTER" ><B >Atenção</B ></TD ></TR ><TR ><TD ALIGN="LEFT" ><P > If you use <TT CLASS="literal" >HASH</TT > for <TT CLASS="literal" >INDEX</TT >, you'll have a deadlock problem when the server load is <SPAN CLASS="emphasis" ><I CLASS="emphasis" >very</I ></SPAN > high. Even if it's unlikely to have a deadlock under normal operation, it can occur. <SPAN CLASS="emphasis" ><I CLASS="emphasis" >Do not use <TT CLASS="literal" >HASH</TT > for <TT CLASS="literal" >INDEX</TT ></I ></SPAN >. </P ></TD ></TR ></TABLE ></DIV ><P > You may change the session table as long as all fields are defined. </P ><P > Application variables table definition <TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="sql" >CREATE TABLE php_app_vars ( app_modified integer, app_name text, app_vars text );</PRE ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="section" ><H1 CLASS="section" ><A NAME="session-pgsql.contact" >Contact Information</A ></H1 ><P > I have at the moment not very much time to further develop this extension. I will implement more and more features in the near future. </P ><P > If you have comments, bug fixes, enhancements or want to help developing this, you can drop me a mail at <A HREF="mailto:yohgaki@php.net" TARGET="_top" >yohgaki@php.net</A >. Any help is very welcome. </P ></DIV ></DIV ><DIV CLASS="TOC" ><DL ><DT ><B >Índice</B ></DT ><DT ><A HREF="function.session-pgsql-add-error.html" >session_pgsql_add_error</A > -- Increments error counts and sets last error message</DT ><DT ><A HREF="function.session-pgsql-get-error.html" >session_pgsql_get_error</A > -- Returns number of errors and last error message</DT ><DT ><A HREF="function.session-pgsql-get-field.html" >session_pgsql_get_field</A > -- Get custom field value</DT ><DT ><A HREF="function.session-pgsql-reset.html" >session_pgsql_reset</A > -- Reset connection to session database servers</DT ><DT ><A HREF="function.session-pgsql-set-field.html" >session_pgsql_set_field</A > -- Set custom field value</DT ><DT ><A HREF="function.session-pgsql-status.html" >session_pgsql_status</A > -- Get current save handler status</DT ></DL ></DIV ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.sesam-settransaction.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Principal</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.session-pgsql-add-error.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >sesam_settransaction</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="funcref.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >session_pgsql_add_error</TD ></TR ></TABLE ></DIV ></BODY ></HTML >