I've not worked on many CGI stuff (other than little things I use myself) but Python has all the housekeeping done. See this other post of mine that has an example of an interactive hello-world: https://news.ycombinator.com/item?id=12712067 . And then, Perl is used for all sorts of CGI stuff. Both have good database support. CGit [1] is a git web interface written in C.
[1] https://git.zx2c4.com/cgit/about/
P.S. An important thing that contributes to the success of PHP is the amount of hosting services that support it.