an unhandled win32 exception occurred in httpd.exe in php-Collection of common programming errors

I have a hard time to install imagemagick for PHP.

I used ImageMagick-6.7.7-8-Q16-windows-dll.exe and added php_imagick.dll into my php ext folder and phpinfo is showing php_imagick extention.

I am on Windows XP using Wamp Server 2.1, PHP 5.3.5, Apache 2.2.17, Mysql 5.5.8

When I run the following code it is resulting in an unhandled win32 exception occurred in httpd.exe:

try
{
    $image = 'exists.jpg';

    /*** a new imagick object ***/
    $im = new Imagick($image);

    echo 'Imagick';
}
catch(Exception $e) 
{
    echo $e->getMessage();
}

Help me in achieving this problem.

Originally posted 2013-11-27 11:52:03.