Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I read this bug report here: <a href="https://bugs.php.net/bug.php?id=51386" rel="noreferrer">https://bugs.php.net/bug.php?id=51386</a></p> <p>Your problem seems to happen because there is a <code>longblob</code> or <code>longtext</code> in the columns of the table.</p> <p><code>longtext</code> / <code>longblob</code> have a maximum length of <code>4294967295</code> [4GB] thats why mysqli tries to allocated that memory for the buffer to be sure nothing is lost. I would suggest that you use <code>mediumtext</code> (16777215 [16MB] max length), that should be enough for everything usually.</p> <p><strong>Update:</strong> Because this answer has seen some activity I add this solution from Phil_1984 (see comments)</p> <blockquote> <p>I use mysqli and after reading that quote from php dev, adding a $stmt->store_result(); between execute and bind_result seems to fix the issues for me</p> </blockquote> <p>=> If you use <code>$stmt-&gt;store_result()</code> you can use mysqli with <code>longblob</code> / <code>longtext</code> without getting the error.</p> <p>-</p> <p><strong>Old Answer:</strong> I suggest that you either change the column to another type (mediumtext) or use PDO (i think it doesnt have that problem). but if you want to keep the column as longtext, you have to switch your mysql library</p> <p>Quote from PHP Dev:</p> <blockquote> <p>This is a known limitation of ext/mysqli when using libmysql (always in 5.2 and previous) and when libmysql is enabled with 5.3 . The reason is that the server sends not too specific metadata about the column. This longtext has a max length of 4G and ext/mysqli tries to bind with the max length, to be sure no data loss occurs (data doesn't fit in the bind buffer on C level). However, that means 4G for a longtext/longblob column. ext/mysqli has been changed to have a way to work around that. You need to call mysqli_stmt_store_result() which will store the data locally, which means, of course a higher memory usage for PHP. However, because you use libmysql this won't hit the PHP's memory limit, for sure. During store_result the max_length of every column will be calculated and then when bind_result is executed only a buffer with size of max_length will be allocated, which will be definitely lower than 4G. In short, prepare execute store_result bind_result fetch...fetch...fetch</p> </blockquote>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload