问题
I'm currently working on inserting image on the firebird database and it's working fine alone, see the code below.
$dbh = ibase_connect($host, $user, $pass);
$blh = ibase_blob_create($dbh);
ibase_blob_add($blh, $data);
$blobid = ibase_blob_close($blh);
$sql = "INSERT INTO blobtable(blobfield) VALUES (?)";
$sth = ibase_query($dbh, $sql, $blobid);
but when I add some data on the insert statement suddenly the apache crash and stops working. See below code when I add new data.
$dbh = ibase_connect($host, $user, $pass);
$blh = ibase_blob_create($dbh);
ibase_blob_add($blh, $data);
$blobid = ibase_blob_close($blh);
$sql = "INSERT INTO blobtable(name, desc, blobfield ) VALUES (?, ?, ?)";
$sth = ibase_query($dbh, $sql, $name, $desc, $blobid);
回答1:
See the blob_create function in this gist:
https://gist.github.com/rowland/d59ee296f8be4b581fed
Probably your $data is larger than the maximum segment size.
来源:https://stackoverflow.com/questions/28801781/php-firebird-insert-blob-file-into-the-database-apache-suddenly-stop-working