Page 1 of 1

"Segmentation fault" using writeImage()

Posted: 2015-10-21T03:20:52-07:00
by hgpit
Hi all,

Setup:
CentOS 6.7
php 5.3.3
ImageMagick 6.7.2-7 2015-07-23
php-pecl-imagick-2.2.2-5.el6.x86_64 (EPEL repo)

I have been using command line tools (i.e.: from Bash) for a long time on this server to manipulate images using ImageMagick, and it's worked fine.
However, I now want to use the Imagick PHP extension, so installed it (as per guides such as http://tecadmin.net/install-imagemagick-on-linux/#), but whenever I run my test PHP, I always receive the same error when it tries to save the image out:

Code: Select all

Segmentation fault (core dumped)
My PHP test script is:

Code: Select all

<?php
function funcMakeThumb($vFullImagePath) {
	echo 'Setting object...'.PHP_EOL;
	$imagick = new Imagick(realpath($vFullImagePath));
	echo 'Resizing...'.PHP_EOL;
	$imagick->thumbnailImage(100, 100);
	echo 'Writing image out to '.pathinfo($vFullImagePath,PATHINFO_DIRNAME).DIRECTORY_SEPARATOR.pathinfo($vFullImagePath,PATHINFO_BASENAME).'.thumb.'.pathinfo($vFullImagePath,PATHINFO_EXTENSION).'...'.PHP_EOL;
	$imagick->writeImage(pathinfo($vFullImagePath,PATHINFO_DIRNAME).DIRECTORY_SEPARATOR.pathinfo($vFullImagePath,PATHINFO_BASENAME).'.thumb.'.pathinfo($vFullImagePath,PATHINFO_EXTENSION));
}

funcMakeThumb('/var/www/haylo.hayley-group.co.uk/images/user.gif');
?>
This is what I see in my /var/log/messages:

Code: Select all

Oct 21 11:16:39 svr-h002607 kernel: php[3992]: segfault at 32b9e0f05c ip 00000032b9e0f05c sp 00007f4f3b47ddb8 error 14
Oct 21 11:16:39 svr-h002607 kernel: php[3990]: segfault at 32b9e0f062 ip 00000032b9e0f062 sp 00007f4f3c87fdb8 error 14
Oct 21 11:16:39 svr-h002607 kernel: php[3988]: segfault at 32b9e0f05e ip 00000032b9e0f05e sp 00007f4f3dc81db8 error 14
Oct 21 11:16:39 svr-h002607 kernel: php[3991]: segfault at 32b9e0f05e ip 00000032b9e0f05e sp 00007f4f3be7edb8 error 14 in libresolv-2.12.so[32ba200000+16000] in libresolv-2.12.so[32ba200000+16000]
Oct 21 11:16:39 svr-h002607 kernel:
Oct 21 11:16:39 svr-h002607 kernel: in libresolv-2.12.so[32ba200000+16000]
Oct 21 11:16:39 svr-h002607 kernel: in libresolv-2.12.so[32ba200000+16000]
Oct 21 11:16:40 svr-h002607 abrt[3993]: Saved core dump of pid 3987 (/usr/bin/php) to /var/spool/abrt/ccpp-2015-10-21-11:16:39-3987 (58740736 bytes)
Oct 21 11:16:40 svr-h002607 abrtd: Directory 'ccpp-2015-10-21-11:16:39-3987' creation detected
Oct 21 11:16:45 svr-h002607 abrtd: Generating core_backtrace
Oct 21 11:16:45 svr-h002607 abrtd: Duplicate: core backtrace
Oct 21 11:16:45 svr-h002607 abrtd: DUP_OF_DIR: /var/spool/abrt/ccpp-2015-10-21-09:20:11-24491
Oct 21 11:16:45 svr-h002607 abrtd: Deleting problem directory ccpp-2015-10-21-11:16:39-3987 (dup of ccpp-2015-10-21-09:20:11-24491)
Oct 21 11:16:46 svr-h002607 abrtd: Sending an email...
Oct 21 11:16:46 svr-h002607 abrtd: Email was sent to: root@localhost
Is this a known problem? Or am I missing something stupid?

I have tried re-installing, even using php-magickwand instead of php-pecl-imagick, but the same fault appears. Oh, I've also tried removing php-pecl-imagick and installing it from 'pecl install imagick'. While it installed fine, I still received the same error.

I'm kinda at my limit with troubleshooting it, so any suggestions would be very much appreciated.

Thank you,

Elliot

Re: "Segmentation fault" using writeImage()

Posted: 2015-10-29T09:53:14-07:00
by hgpit
Nevermind, I decided to just use PHP's GD functions instead.

Re: "Segmentation fault" using writeImage()

Posted: 2015-10-29T13:57:43-07:00
by Bonzo
Imagick is not written or maintained by the developers of Imagemagick and as far as I know there are no regular users of it on this forum.

I assume you have tried something really simple like:

Code: Select all

$im = new imagick('input.jpg');
$im>resizeImage(100,100,imagick::FILTER_LANCZOS, TRUE);
$im->writeImage('output.jpg');
$im->destroy;