ok, let's figure it out ;-)
1. google told me that "exec format error on ..." most time means, that the program can't be executed
think about just copy a .exe from windows to a linux distri, make a chmod, and try to execute the .exe file
i didn't try it, but you should get something like "exec format error on" because linux (the operating system itself) doesn't understand the .exe format
http://minitutorials.com/apache/php12.shtml
http://www.thesitewizard.com/archive/php4install.shtml (for windows, but interesting too)
http://www.webmasterstop.com/48-3.html (windows too)
http://docs.php.net/en/install.unix.apache.html
2. you said you have many cgi routines in /var/www/cgi-bin but no PHP script!
i wrote a cgi prog in C for windows and linux and as far as i know a CGI program is nothing else than a simple executable file which uses environment variables and printf to get apache information and print the response which is shown to the user
i'm not sure, but i never had a php script in cgi-bin!
because a php script is something different! you need php to interpret the script
i'm thinking about 2 problems:
1. i think php itself isn't correctly configured in your apache or the php script itself has to be in a different directory than cgi-bin
(check, apache php configuration and read through some php apache manuals)
2. i don't know if it will work, but heres a workaround
change the script to:
#!/usr/bin/php
<?php
$gpg='/usr/bin/gpg';
$nam='myname@internode.on.net';
$ifile='file2encode.txt';
echo shell_exec("$gpg -e -r $nam $ifile");
?>
the only difference is the first line (#!/usr/bin/php)
you have to change #!/usr/bin/php to the right path to the php executable! (but in most cases it should work)
then make chmod for your script (the script is in cgi-bin already!!) to make it executable
in the command line try
/var/www/cgi-bin/enc.php
if this works!
you can try to use it in the browser (just like you did already)
it's just a workaround