in reply to Perl on M2 Mac issues: somewhere between Perl, Apache and ImageMagick my code fails
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl on M2 Mac issues: somewhere between Perl, Apache and ImageMagick my code fails
by choroba (Cardinal) on Oct 24, 2024 at 08:40 UTC | |
by bliako (Abbot) on Oct 24, 2024 at 09:02 UTC | |
|
Re^2: Perl on M2 Mac issues: somewhere between Perl, Apache and ImageMagick my code fails
by LittleJack (Beadle) on Oct 25, 2024 at 01:04 UTC |