Connection lost to MySQL Server during query
<p>I have got a problem in mysql:
My PHP gets disconnected from MySQL for a simple query. The error is:  </p>

<blockquote>
  <p>Lost connection to MySQL server during query. </p>
</blockquote>

<p>And it is thrown from :</p>

<pre><code>  $stmt-&gt;execute();
</code></pre>

<h2>Here is my PHP code:</h2>

<pre><code>$app-&gt;post('/checkmd5', function() use($app) {
    $data = $app-&gt;request()-&gt;params();
    $version = $data["VERSION"];
    $md5 = $data["MD5"];

    $stmt = getDb()-&gt;prepare("SELECT MD5 FROM UpdateInfo WHERE VersionName = ?");
    $stmt-&gt;bind_param("s", $version);
    $stmt-&gt;execute();
    $stmt-&gt;store_result();
    if ($stmt-&gt;num_rows() &gt; 0) {
        $stmt-&gt;bind_result($dbMD5);
        $stmt-&gt;fetch();
        if ($md5 == $dbMD5)
        {
            $app-&gt;render(200, array("SUCCESS_MD5_MATCH", "VALID" =&gt; "true"));
        }
        else
        {
            $app-&gt;render(400, array("msg" =&gt; "ERROR_NO_MD5_MATCH", "VALID" =&gt; "false"));
        }
    }
    else
    {

        $app-&gt;render(400, array("msg" =&gt; "ERROR_VERSION_STRING_NOT_FOUND", "VALID" =&gt; "false", "VERSION" =&gt; $version));
    }
});
</code></pre>

<h2>In PHPMyAdmin it works:</h2>

<p><a href="https://i.stack.imgur.com/H1vam.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H1vam.png" alt="PHPMyAdmin_Output"></a></p>

<h2>And this is what PHP gives out:</h2>

<p><a href="https://i.stack.imgur.com/kQ477.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kQ477.png" alt="PHP_Api_Output"></a></p>