note 104620 added to function.pg-connect
| From: | pedro2009 at mandic dot com dot br | Date: | Sun, 26 Jun 2011 18:55:01 +0000 |
| Subject: | note 104620 added to function.pg-connect | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-180969@lists.php.net to get a copy of this message | ||
I had problems in a PHP program that uses fork() after pg_connect(); I didn't use any pg
function inside the child, I just keep using pg functions in the parent process.
In this case, the connection gets "duplicated" and when the child finishes, it
automatically calls pg_close() on its destructors, and this makes the parent connection to finish!
If your program needs to fork, then use this sequence:
pg_connect(); do_somethings(); pg_close(); fork(); pg_connect();
And remember: if your program forks, you CAN NOT use the pg_pconnect() function, because it is
persistent.
----
Server IP: 69.147.83.197
Probable Submitter: 186.223.220.101
----
Manual Page -- http://www.php.net/manual/en/function.pg-connect.php
Edit -- https://master.php.net/note/edit/104620
Del: integrated -- https://master.php.net/note/delete/104620/integrated
Del: useless -- https://master.php.net/note/delete/104620/useless
Del: bad code -- https://master.php.net/note/delete/104620/bad+code
Del: spam -- https://master.php.net/note/delete/104620/spam
Del: non-english -- https://master.php.net/note/delete/104620/non-english
Del: in docs -- https://master.php.net/note/delete/104620/in+docs
Del: other reasons-- https://master.php.net/note/delete/104620
Reject -- https://master.php.net/note/reject/104620
Search -- https://master.php.net/manage/user-notes.php