MariaDB / PHP / PDO格式错误的服务器数据包

时间:2019-04-17 17:12:00

标签: php mysql mariadb

我目前正在将许多脚本迁移到另一台服务器上,并且遇到了一个奇怪的问题,我找不到太多的文档。如果您以前曾遇到过此问题,请提供帮助。

我收到以下错误消息:

PDOStatement::fetch(): Malformed server packet. Field length pointing 16 bytes after end of packet in updater.php on line x

错误消息指示错误来自以下脚本中的$row=$to_process->fetch()语句。每次运行此脚本后,数据包结尾后的字节数都会更改,但每次运行时都会发生错误。

    $tables_to_process=array('table_a','table_b','table_c','table_d','table_e','table_f');
    $master_threads=0;
    foreach($tables_to_process as $table)
    {
            $master_threads++;
            sleep(1);
            if(pcntl_fork())
                    continue;

            $pdo=get_pdo(); //creates PDO connection
            $to_process=$pdo->query("select * from big_table_with_accounts where account=\"$table\""); 
            while($row=$to_process->fetch()) //ERROR COMES FROM HERE
            {
                //processing
            }
            exit;
    }
    while($master_threads>0)
    {
            pcntl_wait($status);
            $master_threads--;
    }

服务器信息:

Server: MariaDB Server version: 10.2.15-MariaDB MariaDB Server Protocol version: 10 Connection: 1.1.1.1 via TCP/IP

PDO连接设置:

$opt = [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, PDO::ATTR_EMULATE_PREPARES => true, PDO::MYSQL_ATTR_USE_BUFFERED_QUERY=> false, PDO::MYSQL_ATTR_FOUND_ROWS => true ];

0 个答案:

没有答案