Uncaught exception 'ImagickException'

All of a sudden, I'm seeing these messages in my log. It doesn't happen everywhere and all the time, but now it happens so frequently that the site is not possible to browse.

Today I upgraded to the latest version of zenPhoto ( and zpGallerific (for the correct version of zP) thinking the problem might go away. But it didn't.

These are the two errors I'm seeing in the logs:

[Mon Feb 20 16:58:47 2012] [error] [client] PHP Notice: zenJavascript (called from header.php line 40) is deprecated Use zp_apply_filter("theme_head").You can disable this error message by going to the deprecated-functions plugin options and un-checking zenJavascript in the list of functions. in /srv/www/myalbum.com/public_html/zp-core/zp-extensions/deprecated-functions.php on line 71, referer: http://myalbum.com/2003

[Mon Feb 20 17:05:19 2012] [error] [client] PHP Fatal error: Uncaught exception 'ImagickException' with message 'Unable to annotate image' in /srv/www/myalbum.com/public_html/zp-core/lib-Imagick.php:610\nStack trace:\n#0 /srv/www/myalbum.com/public_html/zp-core/lib-Imagick.php(610): Imagick->annotateimage(Object(ImagickDraw), 1, 3, 0, 'x')\n#1 /srv/www/myalbum.com/public_html/zp-core/c.php(56): zp_writeString(Object(Imagick), Object(ImagickDraw), 1, 1, 'x', Object(ImagickPixel))\n#2 {main}\n thrown in /srv/www/myalbum.com/public_html/zp-core/lib-Imagick.php on line 610, referer: http://myalbum.com/2008/20081123_filip_cuddles.jpg.php


  • I'm also seeing this ... I added some debug output of that line (i.e. echoing out the contents of $root, but I see nothing weird about it)

    [Mon Feb 20 17:23:54 2012] [error] [client] PHP Warning: chdir(): Permission denied (errno 13) in /srv/www/myalbum.com/public_html/zp-core/zp-extensions/colorbox.php on line 75, referer: http://myalbum.com/zp-core/admin-plugins.php
  • acrylian Administrator, Developer
    For the first error: I actually doubt that the latest zpGalleriffic version throws this error as its author has updated it (zenJAvascript is gone for quite some time). But you get a quite detailed note about what to do or update the theme to use the proper function.

    I have no idea for the 2nd error.
  • acrylian Administrator, Developer
    Well, then you have it actually. Wrong permissions.
  • The `ImagickException` issue comes from the image processor being unable to produce a CAPTCHA. Usually, this particular error will be from attempting to use an invalid font. Have you recently changed your CAPTCHA font? Even if you haven't, try changing it to a font that you know will work correctly. It could be that your host has changed something with regards to the fonts available on your server and that the setting needs to be updated.
  • Well, I am using the latest zP and the latest zpGalleriffic version, and now I'm seeing Apache segfaulting and terminating the child process (i.e. the instance running my site). I haven't changed anything to my knowledge, and the host has more or less remained the same throughout a few versions of zP now, other than normal Ubuntu 10.04.LTS updates.
  • The captcha settings are:

    Generator: zenphoto
    Length: 6
    Allowed characters: a-z2-9A-Z, etc (default)
    Captcha font: system
    (and it's displaying a proper captcha in the settings screen)
  • Debugging the code manuall, I get to line 128 of index.php. If I insert a die ('done') before "include(internalToFilesystem($_zp_obj));", it properly shows "done" in the browser. If I let that function execute, Apache segfaults.
  • And now I'm seeing this, after pressing "Apply" on the options screen and re-loading zP:

    [Mon Feb 20 21:52:01 2012] [error] [client] PHP Warning: require_once(/srv/www/myalbum.com/public_html/plugins): failed to open stream: Success in /srv/www/myalbum.com/public_html/zp-core/functions.php on line 26, referer: http://myalbum.com/zp-core/admin.php

    [Mon Feb 20 21:52:01 2012] [error] [client] PHP Fatal error: require_once(): Failed opening required '/srv/www/myalbum.com/public_html/plugins/' (include_path='.') in /srv/www/myalbum.com/public_html/zp-core/functions.php on line 26, referer: http://myalbum.com/zp-core/admin.php

    Is something not quite right here .. ?
  • Well, if this issue has come from out of the blue, and you haven't changed anything to catalyze these errors, then I would hazard a guess that something must have changed about your server to cause these issues. Especially if Apache is segfaulting, it sounds like there's something more at work here.

    The CAPTCHA settings look correct to me, and from the error you first posted, the code looks fine as well. It should be working as-is, but it's simply not if you're still seeing this errors. You really should get in contact with your host to find if anything has changed around the time these errors first began appearing.
  • I have checked with them now. Nothing has changed on their side.

    If I trace the code, some functions are behaving in a really weird manner, and the resulting variables are indeed empty; Apache's (PHP's) error messages are correct ...

    And now I cannot get into the admin interface anymore due to these fatal PHP errors.
  • Copying a new fresh copy of index.php and zp-core over to the actual folder made it work, as far as I was at the very beginning of the thread, in other words, Apache segfaults instead.
  • What's weird is that when it's "normal", the backend works, but the frontend forces Apache to segfault ?!?
  • Just a FYI about those errors that have gone away with the reload of Zenphoto:
    Debugging the code manuall, I get to line 128 of index.php. If I insert a die ('done') before "include(internalToFilesystem($_zp_obj));", it properly shows "done" in the browser. If I let that function execute, Apache segfaults.
    This is the "load" of your theme script for handling the page.
    [Mon Feb 20 21:52:01 2012] [error] [client] PHP Warning: require_once(/srv/www/myalbum.com/public_html/plugins): failed to open stream: Success in /srv/www/myalbum.com/public_html/zp-core/functions.php on line 26, referer: http://myalbum.com/zp-core/admin.php
    This is where Zenphoto loads the captcha handler. But the interesting thing here is that the load attempt is from the `plugins` folder not the `zp-extensions` folder.

    So basically something had got corrupted. If ZP files could get corrupted I presume the Imagick server files could as well. Maybe your host should re-load them.
  • I have now moved everything over to another OpenVZ/Debian6 VPS, and things work better. But it feels like the latest version of zP is *really* slow compared to previous versions. Either that, or something (imageMagick?) is doing is taking a lot of time. Caching is enabled, and they are generated (but rarely cleaned up) .. I've disabled most plugins I can think of.. no errors in the log.
  • acrylian Administrator, Developer
    If you have many and also big images dimension wise they probably need some time to be cached if you moved.

    There are also some things that can slow down the backend and front like random thumbs or the visual album thumb selector.
  • Well, caching aside, everything was sluggish, and the CPU on both cores peaked at 100% every time I did "anything". So I disabled the use of ImageMagick, and voila! All of a sudden, things are back to normal. Fantastic!
  • acrylian Administrator, Developer
    So using GD fixes it? That is strange as it is said that Imagick has the better memory and performance. Maybe you should tell your host, perhaps something is not right with the Imagick install?
  • The Imagick install is plain vanilla Debian 6.0 64-bit install with the latest upgrades applied. There's nothing weird about the installation, and this is the only site on the server ;)

    Something is really weird, I agree, but I don't know what it is. If I re-enable the use of Imagick, it happens immediately. If I disable it, the problem goes away. I have root access to the server.
  • It may be that you're seeing this issue: http://tellgren.com/blog/2011/03/24/trouble-with-imagemagick-on-vps/

    I hadn't heard of this before, since I run on a shared host and not a VPS. I'd be very interested to hear if recompiling ImageMagick with that switch to disable openmp helps performance.
  • Very interesting. I wonder why this wasn't showing up previously though, but I supposed something could have modified IMagick or some add-on to it. Well, I don't really need IMagick since I do all the "magic" outside of zP, and creating thumbs, etc. is something zP can do without it. But this is good to know!
Sign In or Register to comment.