The first thing I would do is to check the web server log.
Have you tried to hardcode the path to the rsh program in your open statement, instead of providing a relative path?
... And you do know that when the script is run under the Webserver, it actually has the UID of the webserver (eg. httpd), not yourself (when you run from the command-line).