Thread: Re: PHP, PostgreSQL and transactions

Re: PHP, PostgreSQL and transactions

From
lbayuk@mindspring.com (ljb)
Date:
nils@mbit.nl wrote:
>Hi all,
>
>I want to make use of PostgreSQL's ability of transactions in a PHP
>application. What happens when a transaction spreads over more than one
>page and a user doesn't continue the transaction?

You can't do it. Read the part in the PHP manual about what persistent
(pooled) connections really are, and what they aren't. They aren't a way
to continue a connection across mutliple page requests. For one thing,
a different web server child process is likely to handle each request.
If you are using persistent connections from PHP to PostgreSQL, you
really must make absolutely sure all transactions are closed at the
end of the page. You can use register_shutdown_function to do this.