db2admin has asked for the wisdom of the Perl Monks concerning the following question:

I have a test machine (Windows 98, local test) where I have successfully run the following syntax:
my $rc; my $im = Image::Magick->new(); $rc = $im->Read("../temp/test.jpg"); warn($rc), next if $rc; .... .... my $geometry = "$newwidth_t x $newheight_t"; $rc = $im->Scale(geometry => $geometry); warn($rc), next if $rc; $rc = $im->Write("JPG:../thumbs/test.jpg"); warn($rc) if $rc;
When I run the above syntax on a Linux machine(shared web server), the write portion
fails with a generic 'internal server error'. In order to eliminate permission problems,
I set the thumbs directory to 777.

Does anyone have any hints as to why this may be erroring out? Or is there a way to debug the
script on the server (since my test platform, Windows 98, is different from the
server platform, Linux). Thanks.

David K.

Replies are listed 'Best First'.
Re: Image Magick question
by Zaxo (Archbishop) on Nov 30, 2002 at 04:54 UTC

    What does the error log say?

    Since I have a free guess, I'll venture that you uploaded by ftp in bin mode, adding a carriage return to the name of perl in the splatline. If so, try again in ftp ascii mode.

    After Compline,
    Zaxo

Re: Image Magick question
by Aristotle (Chancellor) on Nov 30, 2002 at 19:00 UTC
    If the script is properly uploaded, you can add use CGI::Carp qw(fatalsToBrowser); to the top so that you see the die message in your browser. CGI::Carp is always a good idea anyway as it makes your error logs more readable, but remember to remove the qw(fatalsToBrowser) once the script goes public as it may give a cracker valuable information on breaking your script.

    Makeshifts last the longest.

      Thank you very much Aristotle et al. Once I inserted the CGI::Carp module, I was able to debug the script from the browser. I found a syntax error right away. I unknowingly put a "print" statement between the end of an "if" bracket and an "else" bracket when trying to debug the script. Thank you for the great tip!

      David K.

Re: Image Magick question
by vek (Prior) on Nov 30, 2002 at 18:13 UTC
    As zaxo pointed out, your first stop should be the web server error log. If you are using Apache, it's typically located here:
    /usr/local/apache/logs/error_log
    Might be nice if you could post the rest of your code so that we could assist in troubleshooting further.

    -- vek --