mgl.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 Debian possible default full paths are:

/usr/bin/mgl.cgi - from package: mathgl

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