Forum Moderators: coopster

Message Too Old, No Replies

what happen if db connect then pcntl_fork() then use db connection

         

Xuefer

2:48 pm on Jan 8, 2004 (gmt 0)

10+ Year Member



$conn = mysql_connect...
pcntl_fork();
$result = mysql_query($conn, "..");

both parent/child process use same connection?

coopster

3:05 pm on Jan 9, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I was waiting for others to post on this topic, Xuefer, as I don't honestly know the answer either :)

I can offer an educated guess at best -- I would like to think that your answer is Yes, both the child and parent would use the same connection as the manual pages state that the pcntl_fork [php.net] function creates a child process that differs from the parent process only in it's PID and PPID.

However, it also goes on to say Please see your system's fork(2) man page for specific details as to how fork works on your system.

I'm sure you've already read this as well and that's where the clarity begins to dim as it did for me. Have you tested it yet?