|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #58374 Works only in cli-mode
Submitted: 2008-10-11 22:02 UTC Modified: 2021-09-19 04:22 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: spam2 at rhsoft dot net Assigned: cmb (profile)
Status: No Feedback Package: gnupg (PECL)
PHP Version: 5.2.5 OS: Fedora 9
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: spam2 at rhsoft dot net
New email:
PHP Version: OS:


 [2008-10-11 22:02 UTC] spam2 at rhsoft dot net
I have the same problem as on fedora 8 i386 / fedora 9 x86_64
But on both machines it works in CLI-Scripts

So as workaround i have a job-database and a cronjob running every 5 minutes :-(

I do not understand where is the difference and why this happens - It does also not matter if i use the fedora-packages or rebuilt rpms with "-mtune=native"

Reproduce code:
private function send_gpg_mail_direct($subject, $mailbody)
   /** Konfiguration einbinden */
   require($this->install_dir . '');
   /** Extension initailisieren */
   $gnupg = gnupg_init();
    $GLOBALS['cl_api']->log('gnupg_init() failed', 'gpg-mails');
   /** GPG-Key einlesen */
   $keyfile = file_get_contents($mail_gpg_key);
   $key     = gnupg_import($gnupg, $keyfile);
   if(!$key || empty($key['fingerprint']))
    $GLOBALS['cl_api']->log('gnupg_import() failed', 'gpg-mails');
   if(gnupg_addsignkey($gnupg, $key['fingerprint']))
    $signed_body = gnupg_sign($gnupg, $mailbody);
     $GLOBALS['cl_api']->log('gnupg_sign() failed', 'gpg-mails');
    $mailer = new phpmailer();
    $mailer->Host               = $mail_host;
    $mailer->Port               = $mail_port;
    $mailer->Helo               = $mail_helo;
    $mailer->SMTPKeepAlive      = 0;
    $mailer->received_from_name = ' (' . @gethostbyaddr($_SERVER['REMOTE_ADDR_TRANSLATED']) . ')';
    $mailer->ErrorsTo           = $mail_errors_to;
    $mailer->SMTPDebug          = true;
    $mailer->From               = $mail_from;
    $mailer->FromName           = $mail_from_name;
    $mailer->Subject            = $subject;
    if(!empty($mail_bcc) && is_array($mail_bcc))
     foreach($mail_bcc as $zsp_cc)
    $mailer->Body = $signed_body;
    $rw = $mailer->Send();
     $GLOBALS['cl_api']->log('OK: ' . $subject, 'gpg-mails');
     return true;
     $GLOBALS['cl_api']->log('Mail konnte nicht gesendet werden', 'gpg-mails');
     return false;
    $GLOBALS['cl_api']->log('GPG-Key konnte nicht hinzugefuegt werden', 'gpg-mails');

Expected result:
a signed mail

Actual result:
[12-Oct-2008 03:43:01] PHP Notice:  Undefined index:  fingerprint in /etc/httpd/conf/ on line 260


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-11 23:27 UTC] spam2 at rhsoft dot net
Jesus now it will also not work in cli
Trying rpmbuild says the following
Building some other PECL-Extensions this way on the same machine works :-(

ERROR   0002: file '/usr/lib64/php/modules/' contains an invalid rpath '/usr/include/lib' in [/usr/include/lib]                                                                                                   
Fehler: Fehler-Status beim Beenden von /var/tmp/rpm-tmp.56777 (%install)    


[builduser@buildserver:/repo/fc9/x86_64]$ cat /home/builduser/rpmbuild/SPECS/php-pecl-gnupg.spec 
%{!?__pecl:     %{expand: %%global __pecl     %{_bindir}/pecl}}                                  
%{!?php_extdir: %{expand: %%global php_extdir %(php-config --extension-dir)}}                    

%define php_apiver %((echo %{default_apiver}; php -i 2>/dev/null | sed -n 's/^PHP API => //p') | tail -1)
%define pecl_name gnupg                                                                                  

Summary:       wrapper around the gpgme library
Name:          php-pecl-gnupg                  
Version:       1.3.1                           
Release:       3%{?dist}                       
License:       PHP                             
Group:         Development/Languages           
BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: php-devel >= 5.2.0, php-pear,  gpgme-devel >= 1.1.6
Requires(post): %{__pecl}                                         
Requires(postun): %{__pecl}                                       
Provides:      php-pecl(%{pecl_name}) = %{version}                

%if %{?php_zend_api}0
Requires:       php(zend-abi) = %{php_zend_api}
Requires:       php(api) = %{php_core_api}     
Requires:       php-api = %{php_apiver}        
Requires:       gpgme                          

This extension provides methods to interact with gnupg.
%setup -q -c                                           

cd %{pecl_name}-%{version}
%{__make} %{?_smp_mflags}

pushd %{pecl_name}-%{version}
%{__rm} -rf %{buildroot}
%{__make} install INSTALL_ROOT=%{buildroot}


%{__rm} -rf %{buildroot}

%defattr(-, root, root, 0755)

* Sun Oct 12 2008 Reindl Harald <>
 [2008-11-02 03:38 UTC] Fedora at famillecollet dot com
I think, config.m4 need to be fixed

If it found gpgme.h in /usr/include, it will add /usr/include/lib in the rpath rather than /usr/lib

See this patch proposal

 [2008-12-30 00:15 UTC] mick at jmmmj dot net
I just compiled:


all compiled and installed perfectly on rhel3 centos.
a subsequent call to class_exists("gnupg") in a php file confirms the extention module has loaded and is in place and phpinfo also confirms:
GPGme Version 1.1.4
Extension Version 1.3.1 
 $gpg = new gnupg();
 $gpg->addencryptkey("snip key");
 $enc = $gpg->encrypt("just a test");
 echo $enc;
 echo $gpg->geterror();

/gpg/.gnupg and all files under have apache write perms.
This code works perfectly calling the php file on the cli like php -f test.php

... when calling from the webserver, no output occurs and i get 

Warning: gnupg::addencryptkey(): get_key failed
gnupg::encrypt(): no key for encryption set in ...

Any ideas here?
 [2015-01-12 10:32 UTC] anonym at anonym dot com
I had the same problem and it was because this path didnt exist for me:


I changed it to


and now I dont get the fingerprint error any more and gnupg works fine
 [2021-09-10 12:24 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-09-10 12:24 UTC]
Is this still an issue with the latest gnupg (1.5.0)?
 [2021-09-19 04:22 UTC] pecl-dev at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 18:01:30 2024 UTC