Perhaps your shell environment has a different PATH or an alias that adds other command-line options, which your CGI script lacks because it's running in the web server's environment. Try doing "which whois" in the shell and then use the full path in the CGI script.