When you run your perl scripts in browser you would get “500 Internal Server Error” when something goes wrong. There would be several reasons of this but one thing to be done is to check if your perl script contains errors. To do it login to server you’re running perl script (I hope you use Linux ;] ) and execute command:

/usr/bin/perl -w /path/to/script.cgi

It will show debug information and it would be much easier to find and solve the problem.

Good luck!

You may also be interested in:
Access to sqlite3 database through perl (script example)

 

2 Comments

 

  1. June 9, 2009  5:22 am by Dion Reply

    Thanks :-)

  2. April 20, 2011  2:33 am by Tom Reply

    i have a problem to run the script in linux. there is a mistake in the script. so cany you solve for me.........


    #!/bin/bash
    # Process each file and link it if it is okay.
    processfile
    {
    lnopts="$1"
    filename="$2"

    # file must be "normal file"
    if [ ! -f "$filename" ]
    then
    echo Not a normal file: $filename
    retval=1
    # must have "read perms"
    elif [ ! -r "$filename" ]
    then
    echo "No read permissions: $filename"
    retval=1
    # user must either effective owner the file or effective group owner of the file
    elif [ ! -O "$filename" -o ! -G "$filename" ]
    then
    echo "No effective ownership or effective group ownership of file: $filename"
    retval=1
    # Otherwise all is well, link the file to current directory using existing name
    else
    ln $lnopts $filename
    retval=$?
    fi
    # Return the exit status code > 0 if a problem occured
    return $retval
    }
    # Initialise variables
    cont='N'
    lnopts=''

    # Process switches
    while test "$1" = '-c' '-o' "$1" = '-s'
    do
    if [ "$1" = '-c' ]
    then
    cont='Y'
    shift
    fi
    if [ "$1" = '-s' ]
    then
    lnopts='-s'
    shift
    fi
    done

    echo "Commencing generation of files

    if [$# -lt 1]
    while read filename
    do
    processfile "$lnopts" "$filename"
    result=$?
    test $result -ne 0 -a "$cont" != 'Y' -a "$cont" != 'y' || exit 1
    done
    else
    for filename in $*
    do
    processfile "$lnopts" "$filename"
    result=$?
    if [ $result -ne 0 -a "$cont" != 'Y' ]
    then
    echo -n "Error occurred. Continue (y/n/a)? "
    read $cont
    test "$cont" = 'n' -o "$cont" = 'N' && exit 1
    [ "$cont" = 'a' || "$cont" = 'A' ] && cont='Y'
    fi
    done
    fi
    echo "All files processed"

Leave a reply

 

Your email address will not be published.