gnupg_init
(PECL gnupg >= 0.4)
Initialize a connection
Description
Parameters
optionsMust be an associative array. It is used to change the default configuration of the crypto engine.
key type description file_name stringIt is the file name of the executable program implementing this protocol which is usually path of the gpgexecutable.home_dir stringIt is the directory name of the configuration directory. It also overrides GNUPGHOMEenvironment variable that is used for the same purpose.
Return Values
A GnuPG resource connection used by other GnuPG functions.
Changelog
| Version | Description |
|---|---|
| PECL gnupg 1.5.0 | The options parameter was added. |
Examples
Procedural gnupg_init() example with default setting
<?php
$res = gnupg_init();
?>Procedural gnupg_init() example with overridden file name and home dir
<?php
$res = gnupg_init(["file_name" => "/usr/bin/gpg2", "home_dir" => "/var/www/.gnupg"]);
?>OO gnupg initializer example with default setting
<?php
$gpg = new gnupg();
?>OO gnupg initializer example with overridden file name and home dir
<?php
$gpg = new gnupg(["file_name" => "/usr/bin/gpg2", "home_dir" => "/var/www/.gnupg"]);
?>