X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 61B9330EFBF for ; Tue, 17 Jun 2003 12:11:05 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 09290-08 for ; Tue, 17 Jun 2003 09:10:55 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 91FC630EFA8 for ; Tue, 17 Jun 2003 09:10:54 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h5HCA04w002029; Tue, 17 Jun 2003 06:10:00 -0600 (MDT) Date: Tue, 17 Jun 2003 06:08:43 -0600 (MDT) From: "scott.marlowe" To: Cc: Subject: Re: Can the frontend get notifications from the postgres In-Reply-To: <20030617080102.GB1959@metux.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Archive-Number: 200306/190 X-Sequence-Number: 9181 On Tue, 17 Jun 2003 weigelt@metux.de wrote: > On Tue, Jun 17, 2003 at 12:07:31PM +0530, A.Bhuvaneswaran wrote: > > > > LISTEN/NOTIFY is yet another SQL. We can write a rule on an event and let > > it notify. On the other hand, we can have a while(1) process which keeps > > listening for that notification ie.. event. Once the event is occured, the > > listening process would be notified. The listening process can be any > > postgresql client including the one written in C, perl, php, etc. > But the problem still is: how to receive the NOTIFY from an php script ? > which function of the c-client lib can be used for this ? If you're talking about a PHP script running under apache as a module or CGI, then you probably can't (or if you can, you shouldn't due to time out issues and such.) Note that PHP really is a "real programming language", and if you write a program to execute from the command line and detach it can run in the back ground like any other language, even starting child processes and having IPC and all that. Look up the "Process Control Functions" for more on satrting child processes and all. Note that the pcntl_* functions are not guaranteed to behave when run under apache / as a CGI etc...