1
I’m having a problem in PHP that I’ve never seen before, I’m using the Gnupg class to generate encrypted messages, however I can’t use in browser, I was wondering why but I can’t come to the conclusion, maybe security, the generated variable is always empty in the browser, but in the terminal is printed perfectly.
Code:
<?php
$text = "ISSO É UM TESTE";
$enc = encrypt($text);
print $enc;
function encrypt($text){
$gpg = new gnupg();
$gpg->addencryptkey("KEY_AQUI");
$enc = $gpg->encrypt("$text");
return $enc;
}
?>
In the browser, it just doesn’t work, the page is empty, in the terminal with results, as in the image below:
Good afternoon, post the entire code of the index.php you executed in the terminal (if you can simplify), read this: http://answall.com/help/mcve - I am waiting for you to edit your question and put the code in it, I’m sure it will take my comment as a constructive criticism :)
– Guilherme Nascimento
Thank you for answering, well, the code is basically what I had shown, I made the changes, the code I have so far is this.
– Tales Luna
gnupg
is imported as? Or this class is provided with a php extensionextension=foo.so
?– Guilherme Nascimento
yes, it comes from an extension (./usr/lib/php5/20131226/gnupg.so), I normally installed it from apt (linux)
– Tales Luna
Did you download it from the Ubuntu repository? Or did you add a repository? My Debian virtual machine is on another PC, but as soon as possible I will test.
– Guilherme Nascimento
downloaded by the same official (debian)
– Tales Luna
Cool, I don’t know when I’ll be able to test it, but as soon as possible I’ll give you a feedback
– Guilherme Nascimento