Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Problem with daemon
  • I'm trying to create a daemon with FuelPHP. Error:
    2006 - MySQL server has gone away [ SELECT * FROM `jobs` ] in COREPATH/classes/database/mysql/connection.php on line 205 Code looks like:
                     while ( true )
                                {
    
                                            $jobs = \DB::select( '*' )->from( 'jobs' )->execute();
                                            sleep( 1 );
    
                                            foreach ( $jobs as $job )
                                            {
                                                        $pid = pcntl_fork();
    
                                                        if ( !$pid )
                                                        {
                                                                    //do something.
                                                                    exit( $job->id );
                                                        }
                                            }
    
                                            while ( pcntl_waitpid( 0, $status ) != -1 )
                                            {
                                                        $status = pcntl_wexitstatus( $status );
                                                        echo "Child $status completed\n";
                                            }
                                }
    
  • Try the PDO driver, it has a reconnect feature in case of a 2006 error.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion