pcntl_fork and the MySQL connection is gone

前端 未结 5 1862
执笔经年
执笔经年 2020-12-10 11:39

I have a foreach loop that forks within it. After the process forks, it accesses the database. I get an error:

SQLSTATE[HY000]: General error: 2006 MySQL ser         


        
5条回答
  •  囚心锁ツ
    2020-12-10 12:20

    (comment --> answer per poster's request)

    Reading more into it I see forked children do inherit their parent's db connection, and it is a known problem: http://php.net/manual/en/function.pcntl-fork.php#70721

提交回复
热议问题