PLEASE IGNORE THIS QUESITON – I FOUND THAT THE PROBLEM DESCRIBED HERE IS NOT THE REAL PROBLEM.
thanks to those who tried to help.
The problem is gmagick specific. Not a general php issue.
I have this simple code on PHP Version 5.6.40-6+ubuntu18.04.1+deb.sury.org+3
<?php
header("Content-type: image/png");
$base_image = new Gmagick();
$base_image->newImage(3, 3, "#555555");
$base_image->setImageFormat('png');
$x = $base_image->getImage();
echo $x;
?>
It works well (put out a 3×3 image) on ubuntu 16 php 5.6 server.
I’ve created a new Ubuntu 18.04 server from scratch with the same stack (details below) but it crashes on the echo statement.
The error log shows: [Thu Apr 11 11:35:48.110542 2019] [core:notice] [pid 9875] AH00051: child pid 10298 exit signal Segmentation fault
(11), possible coredump in /etc/apache2
What can cause such failure in the echo of a binary string representing an image?
See stack details here
https://www.awesomescreenshot.com/image/3968080/0606779cd806f2d6a6e02828dd643dfd
2
Answers
I am referring to this documentation.
so
var_dump($x);
should give you a proper solution as it’s object not string.Returns a new Gmagick object with the current image sequence.
It’s an Imagick object. You can convert it to string like:
see in: https://www.php.net/manual/en/imagick.getimageblob.php