Answers for "pcntl_fork php mysql "MySQL server has gone away""

PHP
0

pcntl_fork php mysql "MySQL server has gone away"

$model_mod = new Model_Base();
                        $model_mod->disconnect();
                        $pid = pcntl_fork();
                        //Both the parent process and the child process will execute the following code
                        if ($pid == -1) {
                            //Error handling: return -1 when failed to create a child process.
                            die('could not fork');
                        } else if ($pid) {
                            $model_mod->connect();
             
                            //The parent process will get the child process number, so here is the logic executed by the parent process
                            pcntl_wait($status); //Wait for the interruption of the child process to prevent the child process from becoming a zombie process.
                        } else {
                            
                            //The $pid obtained by the child process is 0, so here is the logic executed by the child process.
                        }
Posted by: Guest on October-09-2021

Code answers related to "pcntl_fork php mysql "MySQL server has gone away""

Browse Popular Code Answers by Language