开发者

Using GPG to encrypt .gzip file in CHMOD 777 directory within PHP - Error code 2

To begin, I've tried the two solutions found here: GPG Error Code 2 The best I could. I don't quite understand what to set --homedir dir开发者_如何学Pythonectory to, so maybe I can still try that method if somebody can help me figure out what to set it to.

In the meantime, I know that GPG works fine in the terminal as Root - and the file is created as expected. It's this code that fails with error code 2:

<?php
$file = "/path/to/file.gzp";
system("gpg --encrypt --recipient 'shack' --yes --always-trust " . $file, $returnValue);
?>

Anybody know the issue?


This is a permission issue; when php runs on the webserver, it executes as the user www-data , nobody or so, not root. Configure the pgp keys with the user php's running on (you can test in an interactive shell with su www-data). You may want to specify --homedir /some/directory to store and access the keys in another directory.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜