( ! ) fatal error: uncaught tablestyle=border: 1pxcellspacing=0>tr>tdcolspan=3style=background: #ff9999>b>crypt_gpg_fileexceptionb>: the 'homedir' /library/webserver/.gnupg is not readable or does not exist and cannot be created. this can happen if 'homedir' is not specified in the crypt_gpg options, crypt_gpg is run as the web user, and the web user has no home directory. in b>/usr/local/webdata/andy/fanli/citic/crypt/gpgabstract.phpb> on line b>278b>td>tr>tr>tdcolspan=3style=background-color: #aaaaaa; text-align: center; font-weight: bold;>exception tracetd>tr>tr>tdstyle=text-align: center; background: #cccccc; width:20px; font-weight: bold;>#td>tdstyle=text-align: center; background: #cccccc; font-weight: bold;>functiontd>tdstyle=text-align: center; background: #cccccc; font-weight: bold;>locationtd>tr>tr>tdstyle=text-align: center;>0td>td>crypt_gpg_engine->__construct(array)td>td>/usr/local/webdata/andy/fanli/citic/crypt/gpgabstract.php in /usr/local/webdata/andy/fanli/citic/crypt/gpg/engine.php on line 541
命令行输出的错误信息:
php fatal error: uncaught pear_exception: gpg-agent binary not found.if you are sure the gpg-agent is installed, please specify the location of the gpg-agent binary using the 'agent' driver option.in /usr/local/webdata/andy/fanli/citic/crypt/gpgabstract.php on line 278#0 /usr/local/webdata/andy/fanli/citic/crypt/gpgabstract.php(278): crypt_gpg_engine->__construct(array)#1 /usr/local/webdata/andy/fanli/citic/gpg2.php(9): crypt_gpgabstract->__construct()#2 {main} thrown in /usr/local/webdata/andy/fanli/citic/crypt/gpg/engine.php on line 601fatal error: uncaught pear_exception: gpg-agent binary not found.if you are sure the gpg-agent is installed, please specify the location of the gpg-agent binary using the 'agent' driver option.in /usr/local/webdata/andy/fanli/citic/crypt/gpgabstract.php on line 278#0 /usr/local/webdata/andy/fanli/citic/crypt/gpgabstract.php(278): crypt_gpg_engine->__construct(array)#1 /usr/local/webdata/andy/fanli/citic/gpg2.php(9): crypt_gpgabstract->__construct()#2 {main} thrown in /usr/local/webdata/andy/fanli/citic/crypt/gpg/engine.php on line 601
第一个browser中报的错我分析是权限问题,第二个在shell中运行才是其真正的问题所在,根据提示,使用brew安装gpg-agent。
之后我编写代码如下:
require_once'./crypt/gpg.php';$gpg = new crypt_gpg();$key = getkey();$gpg->adddecryptkey('zhangsanfeng','123456');$encrypted = file_get_contents('wait_for_decrpyt.txt.gpg');$data = $gpg->decrypt($encrypted);echo''
;var_dump($data);exit;终于解密成功!!!
版权声明:本文为博主原创文章,未经博主允许不得转载。
以上就介绍了调试crypt_gpg的过程,包括了方面的内容,希望对php教程有兴趣的朋友有所帮助。