title: Problems with Imagick and PHP
body: <p>My PHP script that uses Imagick gives me this error when I run it:</p>
  
  <blockquote>
    <p>Fatal error: Class 'Imagick' not found in /var/www/vhosts/example.com/script.php on line 320</p>
  </blockquote>
  
  <p>If I run <code>php</code> from SSH it gives me this warning:</p>
  
  <blockquote>
    <p>PHP Warning:  PHP Startup: Unable to load dynamic library
    '/usr/lib/php/modules/imagick.so' - /usr/lib/php/modules/imagick.so: undefined symbol:
    php_checkuid_ex in Unknown on line 0</p>
  </blockquote>
  
  <p>The weird thing is that Imagick is always worked... I've tried to install it but it says that everything is already installed.</p>
  
  <p>The lib is in the correct place:</p>
  
  <pre><code># locate imagick.so
  /usr/lib/php/modules/imagick.so
  </code></pre>
  
  <p>I've tried switching to the beta version of imagick because seems that Imagick has problems with the PHP version 5.4.2 but the problem is not solved:</p>
  
  <pre><code>pear config-set preferred_state beta
  pecl upgrade imagick
  </code></pre>
  
  <p>When I try to upgrade it was failing on the configuration:</p>
  
  <blockquote>
    <p>error: Unable to find MagickWand.h or magick-wand.h header ERROR:
    `/var/tmp/imagick/configure --with-imagick' failed</p>
  </blockquote>
  
  <p>So I've created a symlink of <code>magick-wand.h</code> to <code>/usr/include/ImageMagick/wand/MagickWand.h</code> but now the errors is on the make:</p>
  
  <pre><code>/var/tmp/imagick/imagick_helpers.c:859: error: 'PaletteBilevelMatteType' undeclared (first use in this function)
  /var/tmp/imagick/imagick_helpers.c:859: error: (Each undeclared identifier is reported only once
  /var/tmp/imagick/imagick_helpers.c:859: error: for each function it appears in.)
  make: *** [imagick_helpers.lo] Error 1
  ERROR: `make' failed
  </code></pre>
  
  <p>How can I do?</p>