Page 1 of 1

Imagick works on version check, but gives fatal error on creating instance of a class.

Posted: 2016-05-06T08:59:08-07:00
by BlissDirect
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:

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>";
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
  • 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
This should test for ImageMagick version 6.x
  • 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
But when I write a basic php example. It gives a Fatal error: Class 'Imagick' not found.

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!

Re: Imagick works on version check, but gives fatal error on creating instance of a class.

Posted: 2016-05-06T09:36:29-07:00
by fmw42
I do not know how to couple Imagemagick to Imagick. But Imagemagick 6.6.0.4 is ancient (over 300 versions old). Perhaps your ISP installed a more current imagemagick in a different location.

Re: Imagick works on version check, but gives fatal error on creating instance of a class.

Posted: 2016-05-06T09:48:18-07:00
by BlissDirect
Hi,

I am using Image Magick for the first time, so might got confused with the terms...Sorry for that! Does that mean, the Image Magick is installed successfully, as it is showing the version details?

Thanks in advance

Re: Imagick works on version check, but gives fatal error on creating instance of a class.

Posted: 2016-05-06T10:07:26-07:00
by Bonzo
Imagick is the php API for Imagemagick; check in php.ini to see if it is installed.

Imagemagick used with php tends to be run from exec()

Re: Imagick works on version check, but gives fatal error on creating instance of a class.

Posted: 2016-05-06T10:23:11-07:00
by fmw42
Bonzo, according to the first post, the ISP said that it will not show up in php.ini, because it was installed locally.

"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."

I suspect he has an old Imagemagick installed by the ISP and that is what he is catching and not the one privately installed.

Re: Imagick works on version check, but gives fatal error on creating instance of a class.

Posted: 2016-05-06T15:02:45-07:00
by BlissDirect
I didn't got your point, "not the one privately installed" Can we have multiple installation on the server and the steps we followed for installation were:

http://help.1and1.com/hosting-c37630/we ... 49013.html

Kindly advise, if I missed any steps while installing..

Thanks in advance.

Re: Imagick works on version check, but gives fatal error on creating instance of a class.

Posted: 2016-05-06T15:10:38-07:00
by fmw42
Sorry, I know nothing about installing on servers. You need to check with your ISP to see where you have installed Imagemagick and how it is found by Imagick. Perhaps you have to install Imagick.

Re: Imagick works on version check, but gives fatal error on creating instance of a class.

Posted: 2016-05-06T23:23:38-07:00
by snibgo
BlissDirect wrote:Can we have multiple installation on the server and the steps we followed for installation were:
In that link,in step 6, IM was installed to the directory /kunden/homepages/30/d339922114/htdocs/ImageMagick

I suppose you didn't use that exact directory name, but something else.

That is where your IM is.

Re: Imagick works on version check, but gives fatal error on creating instance of a class.

Posted: 2016-05-09T08:43:44-07:00
by BlissDirect
Hi,

Do I need to use the directory path anywhere?

Thanks in advance.

Re: Imagick works on version check, but gives fatal error on creating instance of a class.

Posted: 2016-05-09T08:57:42-07:00
by snibgo
You installed a version of IM to a directory. If you don't tell PHP where that version is, PHP won't find it.

Re: Imagick works on version check, but gives fatal error on creating instance of a class.

Posted: 2016-05-09T12:57:08-07:00
by BlissDirect
Hi,

I am sorry, I might sound weird, but I didn't understood the meaning of assigning path to PHP... Do you mean in php.ini file? Can you please elaborate.

Thanks in advance.

Re: Imagick works on version check, but gives fatal error on creating instance of a class.

Posted: 2016-05-09T13:53:54-07:00
by snibgo
php.ini rings a bell, but I don't use PHP, so can't advise.

Re: Imagick works on version check, but gives fatal error on creating instance of a class.

Posted: 2016-05-09T14:15:21-07:00
by BlissDirect
I got to learn new thing from 1and1 hosting team, "just to give you a heads up, under shared hosting there is no option for you to reset your server. You will need to have a server package to have access to the root". While reading the steps to install ImageMagick, the last step is to restart the server. Do you guys feel, this will create a problem? Or I do not need a restart as it is installed in the hosting space?

Thanks in advance.

Re: Imagick works on version check, but gives fatal error on creating instance of a class.

Posted: 2016-06-09T08:23:07-07:00
by BlissDirect
For an update, I was able to install the library successfully, after switching from shared server to dedicated server.