Обсуждение: resources limit php -> postgre

Поиск
Список
Период
Сортировка

resources limit php -> postgre

От
"Damien M."
Дата:
Hi,
There is my problem :
When a user runs on my apache-php-pgsql a badly written php script /
page (which for example infinitely loops on an insert or anything else
who saturate my Postgre), other php pages relying on PG become purely
unavailable until this "bad script" aborts.

Is there a way to define a 'per script' limit on php/PG, or anything
else in order to avoid these problems ?

Thank you in advance !
DM


Re: resources limit php -> postgre

От
"Adrian Tineo"
Дата:
> Is there a way to define a 'per script' limit on php/PG, or anything
> else in order to avoid these problems ?

You can set a maximum time for execution. This is set for every script in
php.ini with max_execution_time (default is 30 seconds). You can re-define
your ini value though using ini_set("max_execution_time",$max_time) in every
script that has special needs. You can check
http://www.php.net/manual/en/function.ini-set.php for more info on ini_set
and setting values.

Adrian Tineo


Re: resources limit php -> postgre

От
"Damien M."
Дата:
> You can set a maximum time for execution. This is set for every
script in
> php.ini with max_execution_time (default is 30 seconds).

Thanks for your answer. but this has already been done.
And until it aborts (30 sec) no more DB access...

What I'm looking for is a setting or a way to NEVER let 1 php script
hangs the entire database resources ?


Re: resources limit php -> postgre

От
"Damien M."
Дата:
Seems it's not after all a Postgre problem... The Apache/php server was in
fact very slow due to loops, but not totally unavailable... A bigger CPU
helped a lot.
And indeed, lowering max_execution_time helps a lot !

Thanks for your replies !

> > You can set a maximum time for execution. This is set for every
> script in
> > php.ini with max_execution_time (default is 30 seconds).
>
> Thanks for your answer. but this has already been done.
> And until it aborts (30 sec) no more DB access...
>
> What I'm looking for is a setting or a way to NEVER let 1 php script
> hangs the entire database resources ?
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>
>