Win2k CMD.EXE hangs when exec() called

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrew Crowe

    Win2k CMD.EXE hangs when exec() called

    Hi guys,

    I'm using ImageMagick to do scaling / filtering to uploaded images by
    calling the following:

    exec("cmd.exe /c convert.exe -filters in.jpg out.jpg");

    This works flawlessly on our developlemt servers, but on our webserver
    it'll work for a day or two, then every time exec() is called ImageMagick
    runs, does the conversion and terminates (it's removed from the Task
    Managers display, out.jpg is saved fine), but CMD.EXE stays resident and
    PHP locks up.

    Sometimes just restarting IIS is enough to get it going again, but
    sometimes the whole machine needs rebooting before exec() will work again
    (after that it'll work fine again for a day or two).

    calling exec() without calling cmd.exe results in exactly the same thing so
    I think PHP runs commands through cmd.exe implicitly.

    The version of PHP I'm using is 4.3.8 run using isapi.dll


    Has anyone had any experience with this problem, or has any ideas on things
    I could try next time it happens?

    Regards,
    Andrew Crowe


  • Tom

    #2
    Re: Win2k CMD.EXE hangs when exec() called

    Andrew Crowe wrote...[color=blue]
    > Hi guys,
    >
    > I'm using ImageMagick to do scaling / filtering to uploaded images by
    > calling the following:
    >
    > exec("cmd.exe /c convert.exe -filters in.jpg out.jpg");
    >
    > This works flawlessly on our developlemt servers, but on our webserver
    > it'll work for a day or two, then every time exec() is called ImageMagick
    > runs, does the conversion and terminates (it's removed from the Task
    > Managers display, out.jpg is saved fine), but CMD.EXE stays resident and
    > PHP locks up.
    >[/color]


    Specify the full path?


    E:\>which -a convert
    e:\WINNT5\syste m32\convert.exe

    E:\>convert /?
    Converts FAT volumes to NTFS.

    CONVERT volume /FS:NTFS [/V]

    volume Specifies the drive letter (followed by a colon),
    mount point, or volume name.
    /FS:NTFS Specifies that the volume to be converted to NTFS.
    /V Specifies that Convert should be run in verbose mode.

    E:\>

    hth




    Comment

    • Andy Hassall

      #3
      Re: Win2k CMD.EXE hangs when exec() called

      On Tue, 27 Jul 2004 14:38:36 +0100, "Andrew Crowe" <andrewcrowe_uk @yahoo.co.uk>
      wrote:
      [color=blue]
      >I'm using ImageMagick to do scaling / filtering to uploaded images by
      >calling the following:
      >
      >exec("cmd.ex e /c convert.exe -filters in.jpg out.jpg");[/color]

      Why are you using cmd.exe instead of just running convert.exe directly?

      (I don't tend to use exec() much on Windows so maybe there's some subtlety
      here that requires cmd.exe ?)

      --
      Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
      http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space

      Comment

      • Andrew Crowe

        #4
        Re: Win2k CMD.EXE hangs when exec() called

        [color=blue][color=green]
        >>I'm using ImageMagick to do scaling / filtering to uploaded images by
        >>calling the following:
        >>
        >>exec("cmd.e xe /c convert.exe -filters in.jpg out.jpg");[/color]
        >
        >
        > Why are you using cmd.exe instead of just running convert.exe directly?[/color]

        I've seen other people do it, as I said later in the message
        [color=blue][color=green]
        >>calling exec() without calling cmd.exe results in exactly the same
        >>thing so I think PHP runs commands through cmd.exe implicitly.[/color][/color]

        Comment

        • Andrew Crowe

          #5
          Re: Win2k CMD.EXE hangs when exec() called

          No not the system convert function, ImageMagick's convert.exe

          At any rate I do call it with the full path "C:\Program
          Files\ImageMagi c\convert.exe" -filters in.jpg out.jpg, I just thought it
          would make the email clearer to leave that bit out (as after all it
          worked fine on the dev. server)
          [color=blue]
          > Specify the full path?
          >
          >
          > E:\>which -a convert
          > e:\WINNT5\syste m32\convert.exe
          >
          > E:\>convert /?
          > Converts FAT volumes to NTFS.
          >
          > CONVERT volume /FS:NTFS [/V]
          >
          > volume Specifies the drive letter (followed by a colon),
          > mount point, or volume name.
          > /FS:NTFS Specifies that the volume to be converted to NTFS.
          > /V Specifies that Convert should be run in verbose mode.
          >
          > E:\>[/color]

          Comment

          Working...