Re: [PHP] Trouble with conections between php and postgre

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



 
The lock is caused by PHP the page running the queries locking the user's
SESSION file. The php script execution suspends when running each query so
the lock remains. Subsequent page requests will all pause at
session_start(); while waiting for the lock to be removed.

A session_write_close(); (call it before any db_query is run) can be of
assistance because it writes out the session file and thus no lock will be
kept. The problem is that this will send a cookie header to the client.
Multiple calls send further cookie headers :( IE will die with an unhelpful
error page if it receives around 25 of these headers...

What they really need to implement is a session_pause() and
session_restart(). This has been suggested before and there was even
documentation for these functions but it never made it into a PHP as far I
was aware and the documentation has since been removed from more recent PHP
documentation.

A more permanent way around this might be to use a database to hold the
sessions so you are not subject to the file-locking limitations.
Alternatively you could overide the file based session handling with your
own implementation and choose to discard session data from pages if a more
recent page has tried to access the session.

Regards,

Daniel Walters

-----Original Message-----
From: pgsql-php-owner@xxxxxxxxxxxxxx [mailto:pgsql-php-owner@xxxxxxxxxxxxxx]
On Behalf Of luis linietsky
Sent: Tuesday, October 04, 2005 12:00 AM
To: pgsql-php@xxxxxxxxxxxxxx
Subject: [PHP] Trouble with conections between php and postgre

Hi !, first of all: sorry about my english, i'm not from us.
I 'm using latest versions of postgre 7.4 with php4 and apache2, on a debian
system. I'm working with a really big database, so there are many querys
that takes too much time to be executed (And there's nothig to do about it).
These querys blocks the php page while's being loaded. The problem is that
usually, one excepcts to stop those querys or even close the conection if
the user stops the explorer or closes the window. However, this isn't
hapening, the query keeps running in the database, using resources.
I already try uselessly ignore_user_abort(False), and I don't want to set a
time limit.
¿Any ideas? ¿Am I missing something ?
Thnxs !
(Please, try avoiding those messages like "Get more resources", "Optimize
your querys", "/etc/init.d/postgresql restart", etc.)

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings


---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend


[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux