在 Centos 6.9 上为 PHP 安装 GnuPG 扩展 多个 PHP 版本

在 Centos 6.9 上为 PHP 安装 GnuPG 扩展 多个 PHP 版本

我正在尝试在安装了多个 PHP 版本 5.3、5.6 和 7.0 的服务器上安装 PHP 的 gnuPG pecl 模块。

我只能使用pecl install gnupg基础 5.3 安装。

然而,当手动尝试phpize其他./configure版本时,它从未通过测试。

我从 pecl 下载了最新的稳定版本后,像这样运行它(适用于 php 7.0)

/opt/rh/rh-php70/root/usr/bin/phpize
./configure --with-php-config=/opt/rh/rh-php70/root/usr/bin/php-config
make
make test

上面的输出是

Configuring for:
PHP Api Version:         20151012
Zend Module Api No:      20151012
Zend Extension Api No:   320151012

checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for a sed that does not truncate output... /bin/sed
checking for cc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking how to run the C preprocessor... cc -E
checking for icc... no
checking for suncc... no
checking whether cc understands -c and -o together... yes
checking for system library directory... lib
checking if compiler supports -R... no
checking if compiler supports -Wl,-rpath,... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for PHP prefix... /opt/rh/rh-php70/root/usr
checking for PHP includes... -I/opt/rh/rh-php70/root/usr/include/php -I/opt/rh/rh-php70/root/usr/include/php/main -I/opt/rh/rh-php70/root/usr/include/php/TSRM -I/opt/rh/rh-php70/root/usr/include/php/Zend -I/opt/rh/rh-php70/root/usr/include/php/ext -I/opt/rh/rh-php70/root/usr/include/php/ext/date/lib
checking for PHP extension directory... /opt/rh/rh-php70/root/usr/lib64/php/modules
checking for PHP installed headers prefix... /opt/rh/rh-php70/root/usr/include/php
checking if debug is enabled... no
checking if zts is enabled... no
checking for re2c... no
configure: WARNING: You will need re2c 0.13.4 or later if you want to regenerate PHP parsers.
checking for gawk... gawk
checking host system type... (cached) x86_64-unknown-linux-gnu
checking for gnupg support... yes, shared
checking for gnupg files in default path... found in /usr/include
checking for gpgme_check_version in -lgpgme... yes
checking for gpg... /usr/bin/gpg
checking for a sed that does not truncate output... (cached) /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1966080
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
configure: creating ./config.status
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing libtool commands


Build complete.
Don't forget to run 'make test'.

PHP Warning:  PHP Startup: Unable to load dynamic library '/root/gnupg/gnupg-1.4.0/modules/gnupg.so' - /root/gnupg/gnupg-1.4.0/modules/gnupg.so: undefined symbol: zend_object_store_get_object in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/root/gnupg/gnupg-1.4.0/modules/gnupg.so' - /root/gnupg/gnupg-1.4.0/modules/gnupg.so: undefined symbol: zend_object_store_get_object in Unknown on line 0

=====================================================================
PHP         : /opt/rh/rh-php70/root/usr/bin/php
Warning: PHP Startup: Unable to load dynamic library '/root/gnupg/gnupg-1.4.0/modules/gnupg.so' - /root/gnupg/gnupg-1.4.0/modules/gnupg.so: undefined symbol: zend_object_store_get_object in Unknown on line 0

PHP_SAPI    : cli
PHP_VERSION : 7.0.10
ZEND_VERSION: 3.0.0
PHP_OS      : Linux - Linux webdev2.xxxxxxx-xxxxxxxxxx-xxx.co.uk 2.6.32-696.10.2.el6.x86_64 #1 SMP Tue Sep 12 14:33:29 UTC 2017 x86_64
INI actual  : /root/gnupg/gnupg-1.4.0/tmp-php.ini
More .INIs  :
CWD         : /root/gnupg/gnupg-1.4.0
Extra dirs  :
VALGRIND    : Not used
=====================================================================
TIME START 2017-09-29 15:47:24
=====================================================================
SKIP import a new key into the keyring [tests/gnupg_oo_0001_import.phpt]
SKIP encrypt and decrypt a text [tests/gnupg_oo_encrypt.phpt]
SKIP encryptsign and decryptverify a text [tests/gnupg_oo_encryptsign.phpt]
SKIP export a key [tests/gnupg_oo_export.phpt]
SKIP get keyinfo [tests/gnupg_oo_keyinfo.phpt]
SKIP list signatures [tests/gnupg_oo_listsignatures.phpt]
SKIP sign a text with sigmode SIG_MODE_CLEAR [tests/gnupg_oo_sign_clear.phpt]
SKIP sign a text with mode SIG_MODE_DETACH [tests/gnupg_oo_sign_detach.phpt]
SKIP sign a text with mode SIG_MODE_DETACH and without armored output [tests/gnupg_oo_sign_detach_nonarmor.phpt]
SKIP sign a text with mode SIG_MODE_NORMAL [tests/gnupg_oo_sign_normal.phpt]
SKIP sign a text with mode SIG_MODE_NORMAL and without armored output [tests/gnupg_oo_sign_normal_noarmor.phpt]
SKIP delete a key from the keyring [tests/gnupg_oo_zzz_deletekey.phpt]
FAIL import a new key into the keyring [tests/gnupg_res_0001_import.phpt]
FAIL encrypt and decrypt a text [tests/gnupg_res_encrypt.phpt]
FAIL encryptsign and decryptverify a text [tests/gnupg_res_encryptsign.phpt]
FAIL export a key [tests/gnupg_res_export.phpt]
FAIL get keyinfo [tests/gnupg_res_keyinfo.phpt]
FAIL list signatures [tests/gnupg_res_listsignatures.phpt]
FAIL sign a text with sigmode SIG_MODE_CLEAR [tests/gnupg_res_sign_clear.phpt]
FAIL sign a text with mode SIG_MODE_DETACH [tests/gnupg_res_sign_detach.phpt]
FAIL sign a text with mode SIG_MODE_DETACH and without armored output [tests/gnupg_res_sign_detach_nonarmor.phpt]
FAIL sign a text with mode SIG_MODE_NORMAL [tests/gnupg_res_sign_normal.phpt]
FAIL sign a text with mode SIG_MODE_NORMAL and without armored output [tests/gnupg_res_sign_normal_noarmor.phpt]
FAIL delete a key from the keyring [tests/gnupg_res_zzz_deletekey.phpt]
=====================================================================
TIME END 2017-09-29 15:47:24

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :    0
Exts tested     :   14
---------------------------------------------------------------------

Number of tests :   24                12
Tests skipped   :   12 ( 50.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :   12 ( 50.0%) (100.0%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :    0 (  0.0%) (  0.0%)
---------------------------------------------------------------------
Time taken      :    0 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
import a new key into the keyring [tests/gnupg_res_0001_import.phpt]
encrypt and decrypt a text [tests/gnupg_res_encrypt.phpt]
encryptsign and decryptverify a text [tests/gnupg_res_encryptsign.phpt]
export a key [tests/gnupg_res_export.phpt]
get keyinfo [tests/gnupg_res_keyinfo.phpt]
list signatures [tests/gnupg_res_listsignatures.phpt]
sign a text with sigmode SIG_MODE_CLEAR [tests/gnupg_res_sign_clear.phpt]
sign a text with mode SIG_MODE_DETACH [tests/gnupg_res_sign_detach.phpt]
sign a text with mode SIG_MODE_DETACH and without armored output [tests/gnupg_res_sign_detach_nonarmor.phpt]
sign a text with mode SIG_MODE_NORMAL [tests/gnupg_res_sign_normal.phpt]
sign a text with mode SIG_MODE_NORMAL and without armored output [tests/gnupg_res_sign_normal_noarmor.phpt]
delete a key from the keyring [tests/gnupg_res_zzz_deletekey.phpt]
=====================================================================

You may have found a problem in PHP.

有什么想法吗?这对于 5.6 和 7 来说是一样的。

答案1

好的,就我而言,这是因为我已经在同一个文件夹中为 php 5.3 构建了一个版本。我刚刚删除了该文件夹并重新按照上面的步骤操作。还值得注意的是,测试失败了,但模块加载正常。

相关内容