query.cgi: command not found

Have You tried accessing the binary with the full path?

Maybe Your $PATH variable doesn't contain the default paths? echo $PATH should give something like:

[root@server ~]# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

If it's empty, You may set the PATH variable with this command

export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"

On CentOS possible default full paths are:

/usr/lib/python2.6/site-packages/viewvc/bin/cgi/query.cgi - from package: viewvc

You may install the required package with command yum install {package}

On Debian possible default full paths are:

/usr/share/gforge/www/scm/viewvc/bin/cgi/query.cgi - from package: gforge-web-apache2

You may install the required package with command apt-get install {package}
Error in other languages:
query.cgi: bevel nie gevind nie
query.cgi: comandă negăsită
query.cgi: comando não encontrado
query.cgi: commande introuvable
query.cgi: command not found
query.cgi: käsku ei ole
query.cgi: không tìm thấy lệnh
query.cgi: komanda nerasta
query.cgi: Kommando nicht gefunden.
query.cgi: kommandot finns inte
query.cgi: komut yok
query.cgi: nie znaleziono polecenia
query.cgi: níor aimsíodh an t-ordú
query.cgi: no se encontró la orden
query.cgi: no s'ha trobat l'ordre
query.cgi: opdracht niet gevonden
query.cgi: parancs nem található
query.cgi: perintah tidak ditemukan
query.cgi: príkaz nenájdený
query.cgi: příkaz nenalezen
query.cgi: команда не найдена
query.cgi: командата не е открита
query.cgi: 命令找不到
query.cgi: コマンドが見つかりません