Imagick works on version check, but gives fatal error on creating instance of a class.
Posted: 2016-05-06T08:59:08-07:00
I am trying ImageMagick on 1and1 hosting.
Agent from 1and1 hosting said, Upon checking, You have successfully installed the ImageMagick, it will not show up in phpinfo since this was not installed in our server's backend, this was installed within you're hosting space. You need to use the path where you installed the ImageMagick so you can use it.
When I added this code:
Results:
Test for versions and locations of ImageMagick
Path: convert
Version return code is 0
Version: ImageMagick 6.6.0-4 2015-11-27 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
This should test for ImageMagick version 5.x
My confusion is do I need to include any path before writing the basic php code and if yes, then what path should I include?
Thanks in advance!
Agent from 1and1 hosting said, Upon checking, You have successfully installed the ImageMagick, it will not show up in phpinfo since this was not installed in our server's backend, this was installed within you're hosting space. You need to use the path where you installed the ImageMagick so you can use it.
When I added this code:
Code: Select all
echo '<h2>Test for versions and locations of ImageMagick</h2>';
echo '<b>Path: </b> convert<br>';
function alist ($array) { //This function prints a text array as an html list.
$alist = "<ul>";
for ($i = 0; $i < sizeof($array); $i++) {
$alist .= "<li>$array[$i]";
}
$alist .= "</ul>";
return $alist;
}
exec("convert -version", $out, $rcode); //Try to get ImageMagick "convert" program version number.
echo "Version return code is $rcode <br>"; //Print the return code: 0 if OK, nonzero if error.
echo alist($out); //Print the output of "convert -version"
echo '<br>';
echo '<b>This should test for ImageMagick version 5.x</b><br>';
echo '<b>Path: </b> /usr/bin/convert<br>';
exec("/usr/bin/convert -version", $out, $rcode); //Try to get ImageMagick "convert" program version number.
echo "Version return code is $rcode <br>"; //Print the return code: 0 if OK, nonzero if error.
echo alist($out); //Print the output of "convert -version"
echo '<br>';
echo '<b>This should test for ImageMagick version 6.x</b><br>';
echo '<b>Path: </b> /usr/local/bin/convert<br>';
exec("/usr/local/bin/convert -version", $out, $rcode); //Try to get ImageMagick "convert" program version number.
echo "Version return code is $rcode <br>"; //Print the return code: 0 if OK, nonzero if error.
echo alist($out); //Print the output of "convert -version";
echo "<pre>";
system("type convert");
echo "</pre>";
Test for versions and locations of ImageMagick
Path: convert
Version return code is 0
Version: ImageMagick 6.6.0-4 2015-11-27 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
This should test for ImageMagick version 5.x
- Path: /usr/bin/convert
Version return code is 0
Version: ImageMagick 6.6.0-4 2015-11-27 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
Version: ImageMagick 6.6.0-4 2015-11-27 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
- Path: /usr/local/bin/convert
Version return code is 127
Version: ImageMagick 6.6.0-4 2015-11-27 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
Version: ImageMagick 6.6.0-4 2015-11-27 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2010 ImageMagick Studio LLC
Features: OpenMP
convert is /usr/bin/convert
My confusion is do I need to include any path before writing the basic php code and if yes, then what path should I include?
Thanks in advance!