Page 1 of 1

Exit status 11 in exec'd CLI script

Posted: 2011-03-11T16:07:10-07:00
by Jesdisciple
I need to thumb images in a separate process while the server sends an HTTP response, so I'm exec'ing a PHP CLI script. When the script is run directly by CLI, it works fine; but when I exec it, Imagick forces the exit status to 11 despite my exit(0). The latest point at which I can exit to prevent the 11 status is just before flattenImages is called.

PHP CLI source: http://codepad.org/WTHOiWw0 (designed for execution either as ordinary PHP or via CLI)
example CLI invocation: php -f lib/php/thumb_test.php -- img=om3e2a
issue history: http://stackoverflow.com/questions/5255 ... es-it-mean

I tried to minimize that test-case by taking out all the validation and database interaction, but when I tried the 11 status left.

Thanks for any help.

Re: Exit status 11 in exec'd CLI script

Posted: 2011-03-11T16:15:02-07:00
by fmw42
Not that I can help much. But it looks to me that you are using Imagick rather than PHP exec. Do I misunderstand? Why do you have to flatten the image right after creating it? Does it have multiple frames/layers?

Re: Exit status 11 in exec'd CLI script

Posted: 2011-03-11T17:38:59-07:00
by Jesdisciple
That script is being invoked by exec'ing the given CLI invocation. Some images (example: an animated GIF, the one I discovered this with) have multiple layers, so I figured it would be best to flatten just in case. The 11 status is returned consistently, regardless of layers or no layers.

Significantly, the image is produced successfully and direct invocation via terminal returns exit status 0.

Re: Exit status 11 in exec'd CLI script

Posted: 2011-03-13T18:06:32-07:00
by Jesdisciple
I finally thought to check Apache's error.log, and the 11 status was accompanied by this: PHP Warning: Module 'imagick' already loaded in Unknown on line 0

I found the solution here: http://www.somacon.com/p520.php Apparently I accidentally put an extra << extension="imagick.so" >> line in php.ini. Removing it allowed the CLI script to return status 0.