in reply to
"libc.so.6: version `GLIBC_2.4' not found" when running library on different machine
That sounds like two distinct errors, though a lib failure might produce the 500. You'd find it helpful to have shell access on the server to diagnose this. Failing that, try running your script on the spare box with RHL9. You'll get better error messages running your cgi script in the shell. See the CGI docs for how to feed it cgi params from the command line.
The strace util is very helpful for detailed diagnosis of failed system calls. Dll search path differences are a likely culprit.