在这里记录一下以供后来人参考吧
http://devzone.zend.com/article/1265 这篇文章很不靠谱,看了下面的讨论一条条试下来终于找到可用的了...
用这个即可
<?php
$gpg = '/usr/bin/gpg';
$passphrase = 'password';
$unencrypted_file = "foo";
$encrypted_file = "bar";
$cmd = "$gpg --no-tty --homedir /var/www/.gnupg --yes --passphrase=$passphrase -o $unencrypted_file -d $encrypted_file";
shell_exec($cmd);
?>
重点是 --no-tty 选项和 --homedir选项

没有评论:
发表评论