Automator workflow runs forever
Limitations of Automator

Your Automator workflow may require access to the WindowServer to work. Automator is designed to be run within an active user session, and not from a shell session.

The Apache user launching your Automator workflow is running without access to the WindowServer and this will likely limit which actions you can use.

ImageMagik

Consider using an image processing tool designed for command line use, such as ImageMagik. Take a look at the -greyscale option for your conversion:

convert in.png -grayscale Rec709Luminance out.png