Problems with IIS 7 and ImageMagick

Fresh0razoR

Joined: 2009-10-30
Posts: 9
Posted: Fri, 2009-10-30 20:22

Hello everyone!

I just installed Gallery 2.3 on my IIS 7 without any problems (except of gettext was disabled, but that was easy to fix in php.ini). But when I try to configure ImageMagick, I just get always the same error as follows:

------------------------------------------------
Binary Name Pass/Fail
identify
Failed
Error messages:

Problem executing binary:

identify
Failed
Error messages:

Problem executing binary:

convert
Failed
Error messages:

Problem executing binary:

composite
Failed
Error messages:

Problem executing binary:
------------------------------------------------

En Detail:
------------------------------------------------
is_dir(c:\Program Files\ImageMagick\)
Loading plugin imagemagick
imagemagick plugin successfully instantiated
Check the version of the imagemagick plugin
The version of the imagemagick plugin is ok
getcwd()
chdir(C:\inetpub\g2data\tmp\)
is_dir(c:\Program Files\ImageMagick\)
file_exists(c:\Program Files\ImageMagick\gm.exe)
file_exists(c:\Program Files\ImageMagick\identify.exe)
Executing: cmd /c " "c:\Program Files\ImageMagick\identify.exe"
"C:\inetpub\wwwroot\modules\imagemagick\data\test.gif" 2>
"C:\inetpub\g2data\tmp\g2d1AB9.tmp" "
getParameter exec.expectedStatus for core plugin
file_exists(C:\inetpub\g2data\tmp\g2d1AB9.tmp)
filesize(C:\inetpub\g2data\tmp\g2d1AB9.tmp)
unlink(C:\inetpub\g2data\tmp\g2d1AB9.tmp)
Regular Output:
Error Output:
Status: 1 (expected 0)
is_dir(c:\Program Files\ImageMagick\)
file_exists(c:\Program Files\ImageMagick\gm.exe)
tempnam(C:\inetpub\g2data\tmp\, imgk_)
file_exists(c:\Program Files\ImageMagick\convert.exe)
Executing: cmd /c " "c:\Program Files\ImageMagick\convert.exe" "-size"
"200x200" "-geometry" "200x200"
"C:\inetpub\wwwroot\modules\imagemagick\data\test.gif"
"gif:C:\inetpub\g2data\tmp\img1ACA.tmp" 2>
"C:\inetpub\g2data\tmp\g2d1ACB.tmp" "
getParameter exec.expectedStatus for core plugin
file_exists(C:\inetpub\g2data\tmp\g2d1ACB.tmp)
filesize(C:\inetpub\g2data\tmp\g2d1ACB.tmp)
unlink(C:\inetpub\g2data\tmp\g2d1ACB.tmp)
Regular Output:
Error Output:
Status: 1 (expected 0)
unlink(C:\inetpub\g2data\tmp\img1ACA.tmp)
is_dir(c:\Program Files\ImageMagick\)
file_exists(c:\Program Files\ImageMagick\gm.exe)
file_exists(c:\Program Files\ImageMagick\combine.exe)
file_exists(c:\Program Files\ImageMagick\composite.exe)
file_exists(c:\Program Files\ImageMagick\composite.exe)
is_dir(c:\Program Files\ImageMagick\)
file_exists(c:\Program Files\ImageMagick\gm.exe)
tempnam(C:\inetpub\g2data\tmp\, imgk_)
Executing: cmd /c " "c:\Program Files\ImageMagick\composite.exe"
"-geometry" "+0+0" "C:\inetpub\wwwroot\modules\imagemagick\data\test.jpg"
"C:\inetpub\wwwroot\modules\imagemagick\data\test.gif"
"gif:C:\inetpub\g2data\tmp\img1AFB.tmp" 2>
"C:\inetpub\g2data\tmp\g2d1AFC.tmp" "
getParameter exec.expectedStatus for core plugin
file_exists(C:\inetpub\g2data\tmp\g2d1AFC.tmp)
filesize(C:\inetpub\g2data\tmp\g2d1AFC.tmp)
unlink(C:\inetpub\g2data\tmp\g2d1AFC.tmp)
Regular Output:
Error Output:
Status: 1 (expected 0)
unlink(C:\inetpub\g2data\tmp\img1AFB.tmp)
chdir(C:\inetpub\wwwroot)
------------------------------------------------

Can anyone help me out here??? Thank you!!!!

Login or register to post comments
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 2670
Posted: Fri, 2009-10-30 20:46

IUSR_machinename needs execute permissions on c:\Program Files\ImageMagick\*.exe
AND c:\windows\system32\cmd.exe

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

Login or register to post comments
Fresh0razoR

Joined: 2009-10-30
Posts: 9
Posted: Sat, 2009-10-31 17:35

this is the problem: IUSR_machinename doesn't exist in windows server 2008 and IIS 7

=> it is also not possible under server 2008 to give IUSR access rights to cmd.exe in server 2008.

IUSR hast full rights to c:\Program Files\ImageMagick\*.exe

Login or register to post comments
brashquido

Joined: 2006-09-13
Posts: 56
Posted: Sun, 2009-11-01 01:50

I'm using ImageMagick on IIS 7 without any issues. From the output you've given it would appear that permissions on cmd.exe is what is lacking rather than anything with ImageMagick. What does the following command give you;

cacls %COMSPEC%

Also, are you using a specific user in IIS 7, or are you just using the default application user? If the later, I'd say you'll need to give read & execute to cmd.exe to the network service account. If I were you I would create a Gallery 2 user and then configure you're website in IIS 7 (click on website -> basic settings -> connect as) to use that user. The network service account is used for more than just IIS and is a known account, so probably not a good idea to go giving it execute access to your command line interpreter.

Login or register to post comments
Fresh0razoR

Joined: 2009-10-30
Posts: 9
Posted: Sun, 2009-11-01 02:23

thank you very much for your answer!!!! this sounds very good. when I enter "cacls %COMSPEC%" it gives:

"C:\WIndows\system32\cmd.exe NT SERVICE\TrustedInstaller:F
VORDEFINIERT\Administratoren:R
NT-AUTORITÄT\SYSTEM:R
VORDEFINIERT\Benutzer:R"

Translation:
Benutzer = User
Vordefiniert = Predefined

When I write:
"cacls %COMSPEC% /E /G IUSR:R" it says "Zugriff verweigert" (means "Access denied"). So I cannot add Users to cmd.exe !?

I think this is a problem of Server 2008?
Thank you!!

Login or register to post comments
brashquido

Joined: 2006-09-13
Posts: 56
Posted: Sun, 2009-11-01 03:19

I think you'll find this is by design, as you can't edit permissions for cmd.exe from then GUI either. I think I read somewhere to get "around" this you need to boot into safe mode to alter permissions on cmd.exe.

Again, I'd recommend that you create an application user for IIS, ensure they are a member of the users group (which is the default anyway) so you have access to cmd.exe and then configure your website to use that account as described in my previous post. If you dig hard enough I'm sure you'll be able to find a way to alter the permissions for cmd.exe, however it is more secure and far more straight forward just to create an application user for it.

Login or register to post comments
Fresh0razoR

Joined: 2009-10-30
Posts: 9
Posted: Mon, 2009-11-02 01:51

thanks for your response!!

do I see it correctly, that I get the same problem with a application user? because I need to change the user rights of cmd.exe which is not possible by default. so this will make a big problem for me because I am not able to go to safe mode (its a hosted server). strange situation....

EDIT: I have now found a way to change permissions of cmd.exe (I changed the owner from trustedinstaller to administrator). Now the Situation is:

IUSR has FULL access to g2data
IUSR has FULL access to ImageMagick-6.5.7-Q16
IUSR has READ access to cmd.exe

is that enough? if yes, the problem is not solved... :(((

Login or register to post comments
brashquido

Joined: 2006-09-13
Posts: 56
Posted: Mon, 2009-11-02 10:55

IUSR will need read AND execute to cmd.exe. That should do it though.

Login or register to post comments
Fresh0razoR

Joined: 2009-10-30
Posts: 9
Posted: Mon, 2009-11-02 19:43

Now IUSR has FULL access, same error...

Login or register to post comments
Fresh0razoR

Joined: 2009-10-30
Posts: 9
Posted: Tue, 2009-11-03 02:57

okay, not I just gave the rights to the stuff above to EVERYONE. now I don't get the old error anymore. so this helped! but now I get this error:

Error (ERROR_TOOLKIT_FAILURE)
in modules\imagemagick\classes\ImageMagickToolkitHelper.class at line 592 (GalleryCoreApi::error)
in modules\imagemagick\AdminImageMagick.inc at line 255 (ImageMagickToolkitHelper::discoverVersion)
in modules\core\SiteAdmin.inc at line 209 (AdminImageMagickView::loadTemplate)
in modules\core\classes\GalleryView.class at line 293 (SiteAdminView::loadTemplate)
in main.php at line 465 (GalleryView::doLoadTemplate)
in main.php at line 104
in main.php at line 88

maybe this error is easier to solve??

Login or register to post comments
nivekiam
nivekiam's picture

Joined: 2002-12-10
Posts: 9283
Posted: Tue, 2009-11-03 16:45

Try reinstalling IM to a root directory that has no spaces, something like c:\ImageMagick\

Also try giving the NETWORK SERVICE permission to execute
http://gallery.menalto.com/node/75599
http://gallery.menalto.com/node/91813#comment-324761
____________________________________________
Like Gallery? Like the support? Donate now!!! See G2 live here

Login or register to post comments
Fresh0razoR

Joined: 2009-10-30
Posts: 9
Posted: Thu, 2009-11-05 14:52

I did that, but I always get the error above... :(

Login or register to post comments
Fresh0razoR

Joined: 2009-10-30
Posts: 9
Posted: Thu, 2009-11-05 18:38

this is the strangest thing: with gallery 1.5 it works!!!!

maybe g2 is buggy???

Login or register to post comments