I’m trying to insert image converted with imagick to bytea field.
$imagick->scaleImage(800, 1300, true);
$this->_thumbnail = base64_encode($imagick);
# Save to Postgresql
DECODE('{$image->getThumbnail()}', 'base64')
Some images work but others give me errors.
From lighttpd log:
2011-10-27 20:39:02: (mod_fastcgi.c.2566) unexpected end-of-file (perhaps the fastcgi process died): pid: 0 socket: unix:/srv/.../x.socket
2011-10-27 20:39:02: (mod_fastcgi.c.3354) response not received, request sent: 45894 on socket: unix:/srv/.../x.socket for /index.php?, closing connection
/var/log/messages:
Oct 27 20:39:03 linux kernel: [33328.101710] php-cgi[17873]: segfault at 7fffa8fbbf48 ip 00007fd590910ff6 sp 00007fffa8fbbf00 error 6 in libpcre.so.0.0.1[7fd590900000+35000]
Oct 27 20:39:03 linux postgres[29093]: [5-1] 2011-10-27 20:39:03 CEST x x LOG: unexpected EOF in client connection
It may be the external process that php-cgi invokes that is segfaulting so check that. Try executing the equivalent ImageMagick command on the same data.
Just used nginx with php-fpm to make sure it’s not spawn-fcgi but “2011/10/28 09:23:03 [error] 16020#0: *1 recv() failed (104: Connection reset by peer) while reading response header from upstream.” When I insert just base64 encoded data to bytea field postgres never reported any error. Must be something with DECODE() function.