To the point: this code craps out at the exec() function ...error code returned is 7 (?) and $output is Array with count=0 and $msg_enc_file doesn't get written. Any ideas/flames would be appreciated.
<?
//this is supposedly correct (no telnet so not verified)
putenv("PGPPATH=/home/mbrother/.pgp");
//generate unique filename (to be in writeable location)
$msg_enc_file = "./pgp/".md5(uniqid(rand()));
//test message
$msg = "Test data to encrypt";
//0x10F112FB is my keyID & the pgp location is supposedly correct (no telnet so not verified)
$command = "echo '$msg' | /usr/local/bin/pgp -r 0x10F112FB -o $msg_enc_file";
$result = exec($command, $output, $errorcode) or die("I wonder what this error code means: ".$errorcode);
// retrieve and send the data (/usr/local/bin/pgp seems to crap out so $msg_enc_file is not written)
$fp = fopen("$msg_enc_file", "r") or die("no file?");
$msg_crypted = fread($fp, filesize("$msg_enc_file"));
fclose($fp);
unlink("$msg_enc_file");
mail("mbrothers@secmgmt.com","pgp test",$msg_crypted);
?>