Jump to content

Recommended Posts

I can't get GnuPG / GPG to work on my shared server:

 

- gpg is installed on the server

- no functions are disabled in php.ini Anyway, I checked and exec works.

- .htaccess allows ExecCGI (just in case this has anything to do with the problem)

- gpg and home path are correct according to:

$_SERVER['DOCUMENT_ROOT'];

and

exec("which gpg");

- in gnupg folder: pubring.gpg, random_seed, secring.gpg, trustdb.gpg are all cmod 644.

 

I run the code but absolutely nothing is outputted not even errors... nothing... not even when setting error reporting to "eall".

 

I have tried all the php tutorials I could find on the net but they all have the same problem: they don't output anything.

 

I created a "4096" bit?byte? public key with a key password. Does this password have to be included somewhere in the code ?

 

<?php
$gpg = '/usr/bin/gpg';
$recipient = 'sample@email.com';
$texttoencrypt = 'Sample text to encrypt.';
$key_dir = '/home/myusername/.gnupg';

$shellreturn = shell_exec("$gpg -e --homedir $key_dir --no-secmem-warning -r $recipient $texttoencrypt");
echo $shellreturn;
?>

Link to comment
https://forums.phpfreaks.com/topic/84661-gnupg-gpg-not-working/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.