[BlueOnyx:19868] Re: GD image problem

Michael Stauber mstauber at blueonyx.it
Sat Jul 23 10:55:53 -05 2016


Hi Bart,

> I have noticed that programs which are using GD wouldn't work.
> 
> Main problem, it wouldn't display image code used in mailform
> and programs which are relying on GD to resize image, 
> wouldn't work.

Do you by chance have an actual code sample that isn't working?

The thing is: PHP has a couple of different methods how to generate and
manipulate images.

Something like this will work just fine - even on 5209R:

<?
header("Content-Type: image/png");
$im = @imagecreate(110, 20)
    or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>

It works fine, because it just uses GD to do these things. There are
other forms of creating/manipulating images via PHP, which rely on
external programs as provided by ImageMagick to convert or modify
images. While GD is native (i.e.: built into PHP), ImageMagick usage
requires that PHP has access to these external binaries:

/usr/bin/animate
/usr/bin/compare
/usr/bin/composite
/usr/bin/conjure
/usr/bin/convert
/usr/bin/display
/usr/bin/identify
/usr/bin/import
/usr/bin/mogrify
/usr/bin/montage
/usr/bin/stream

As you can see, they reside in /usr/bin/ and it could be that your
OpenBasedir restrictions for that Vsite don't allow the PHP script(s)
access to /usr/bin/ for security reasons.

So please add /usr/bin/ to your OpenBasedir allowances in the PHP
configuration of that Vsite and see if that fixes the problem.

-- 
With best regards

Michael Stauber



More information about the Blueonyx mailing list