2

I want to use PGP in my PHP project, using XAMPP on Windows.

When I run this code:

$public_key = "PGP Public Key";
$gpg = new gnupg();
$key = $gpg->import($public_key);
$gpg->addencryptkey($key['fingerprint']);
$enc = $gpg->encrypt("Hello Stackoverflow!");
$gpg->clearencryptkeys();
echo nl2br($enc);

I get an error message telling me that I have to install the GNUPG extension in my Apache server.

How do I install GNUPG for XAMPP on Windows? I only found solutions for Linux.

janw
  • 8,758
  • 11
  • 40
  • 62
Luciana
  • 21
  • 1
  • 4

2 Answers2

1

As per the official php-gnupg repository, there's no extension for Windows yet.

The extension is not currently supported on Windows due to unavailable GpgME library builds that would be supported by PHP.

tntsoft
  • 11
  • 1
  • 1
0

You need to add libgpgme-11.dll, php_gnupg.dll, libgpg-error.dll

Extensions pack to your php.ini configuration file

https://www.gnupg.org/download/index.html

Carmel
  • 41
  • 3