When you get a 500 error it is usually because the program has die()ed
before producing valid output. The message it died with can be found in
your server logs.
So find the entry in the logs where your program failed
and the error message within should point you towards the solution.