Note about installing ImageMagick w/ mod_perl2 in Apache 2.2
Posted: 2009-12-15T00:05:11-07:00
I've been dealing with some strange errors after installing ImageMagick on a Windows XP Pro SP3 system running ModPerl 2, libapreq2, and Apache 2.2. The errors indicated that DynaLoader couldn't find ImageMagick's DLL file when using the LoadFile directive in the "httpd.conf" file. Here are two errors from Apache HTTPd's error log (the second error occurs when the "LoadFile" directive isn't used to pre-load ImageMagick's DLL file; time and other sensitive information was obscured as per privacy requirements):
The solution to this problem was to reboot Windows (stopping and starting the Apache 2.2 Windows service also didn't make a difference), even though the path wasn't altered. After rebooting, the ImageMagick-specific lines below didn't cause errors, and the script was compiled and executed successfully and consistently:[Mon Dec 14 18:38:58 2009] [error] Can't load 'C:/Perl/site/lib/auto/Image/Magick/Magick.dll' for module Image::Magick: load_file:The specified module could not be found at C:/Perl/lib/DynaLoader.pm line 201.\n at C:/internet/com/example/www/script.pl line 6\nCompilation failed in require at C:/internet/com/example/www/script.pl line 6.\nBEGIN failed--compilation aborted at C:/internet/com/example/www/script.pl line 6.\n
[Mon Dec 14 18:38:58 2009] [error] [client 10.88.88.88] Can't locate ModPerl/ROOT/ModPerl/Registry/C_3a_UNIQUE_NAME_2epl.pm in @INC (@INC contains: C:/Perl/site/lib C:/Perl/lib . C:/Program Files/Apache Software Foundation/Apache2.2) at C:/Perl/site/lib/Apache2/Reload.pm line 176.\n, referer: http://www.example.com/script.pl
I hope this will be helpful information for anyone else who encounters this issue. Please note that this seems to be a Windows-specific problem as it doesn't occur on NetBSD (and I suspect this to not be a problem for all other flavours of Unix including Linux and MacOS as well).#
# Pre-loads for mod_perl2.
#
LoadFile "C:\Perl\site\lib\auto\Image\Magick\Magick.dll"
PerlModule Apache2::Reload
PerlModule Apache2::Request
PerlModule Image::Magick
PerlInitHandler Apache2::Reload