I do not know much about apache, this is on the perl side of your problem.

my $result = `$command`; ... executed  as  a system  command,  via /bin/sh or its equivalent if required. see qx/STRING/

So, additionally to checking 1) if the convert binary is indeed installed in said location, 2) if apache is allowed to execute arbitrary binaries from arbitrary filesystem locations, 3) if the current apache user is allowed to do the above for the specific binary, you must also check if apache is also allowed to spawn a shell (and knows where to find its binary).

In order to debug this, I would use Perl's system command passing the command as an array in order to run the convert binary without spawning an intermediate shell, e.g.:

my @command = ( "/opt/local/bin/convert", "foo.jpg". "-crop", "${w}x$h+$x+$x", "./cropped/foo.jpg" ); my $ret = system(@command);

Make sure you check $ret to be zero for successful execution, otherwise check system on how to decipher the return code.

Also, I would try a different, simple binary, check its permissions, move the binary in the current directory where you make sure the apache user has permissions, etc.

Also, please have a look at The problem of "the" default shell and the comments therein which provide system()/qx/`` alternatives (for example: Re: The problem of "the" default shell).

p.s. There may be apache or system logs to explain what happened.

EDIT: Question: where is that exit code (6) documented?

bw, bliako


In reply to Re: Perl on M2 Mac issues: somewhere between Perl, Apache and ImageMagick my code fails by bliako
in thread Perl on M2 Mac issues: somewhere between Perl, Apache and ImageMagick my code fails by LittleJack

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.