in reply to Calling a method inside CGI script using system calls
I presume it has something to do with the permissions-thing. The user under which the script runs is not the same as your user when you manually run the program.
You should ajust the permissions for the program and the template it uses...