Linux
為 PHP 安裝 GnuPG 擴展
系統:執行 Debian 5.0.1 和 Apache 2 和 PHP 5.2.6 的 Amazon EC2 實例
我需要使用 PHP 腳本發送加密文件。我一直打算使用腳本中的命令行指令(例如 exec())來執行此操作,但我發現 GnuPG 有一個 PHP 擴展。我使用本演練中提供的步驟安裝了它,儘管我使用了所提到的軟體包的最新版本(libgpg-error-1.10、gpgme-1.3.1 和 gnupg-1.3.2)。當我進入 gnupg-1.3.2 安裝的“make”步驟時,我被告知執行“make test”。當我這樣做時,我收到以下錯誤/警告:
PHP Warning: PHP Startup: Unable to load dynamic library 'modules/curl.so' - modules/curl.so: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/curl.so' - modules/curl.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'modules/gd.so' - modules/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/gd.so' - modules/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'modules/mcrypt.so' - modules/mcrypt.so: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/mcrypt.so' - modules/mcrypt.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'modules/mysql.so' - modules/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/mysql.so' - modules/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'modules/mysqli.so' - modules/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/mysqli.so' - modules/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'modules/pdo.so' - modules/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/pdo.so' - modules/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'modules/pdo_mysql.so' - modules/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/pdo_mysql.so' - modules/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'modules/gnupg.so' - libgpgme.so.11: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/gnupg.so' - libgpgme.so.11: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'modules/curl.so' - modules/curl.so: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/curl.so' - modules/curl.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'modules/gd.so' - modules/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/gd.so' - modules/gd.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'modules/mcrypt.so' - modules/mcrypt.so: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/mcrypt.so' - modules/mcrypt.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'modules/mysql.so' - modules/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/mysql.so' - modules/mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'modules/mysqli.so' - modules/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/mysqli.so' - modules/mysqli.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'modules/pdo.so' - modules/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/pdo.so' - modules/pdo.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'modules/pdo_mysql.so' - modules/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/pdo_mysql.so' - modules/pdo_mysql.so: cannot open shared object file: No such file or directory in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library 'modules/gnupg.so' - libgpgme.so.11: cannot open shared object file: No such file or directory in Unknown on line 0 Warning: PHP Startup: Unable to load dynamic library 'modules/gnupg.so' - libgpgme.so.11: cannot open shared object file: No such file or directory in Unknown on line 0 ===================================================================== PHP : /usr/bin/php PHP_SAPI : cli PHP_VERSION : 5.2.6-1+lenny13 ZEND_VERSION: 2.2.0 PHP_OS : Linux - Linux ip-10-235-58-131 2.6.21.7-2.fc8xen #1 SMP Fri Feb 15 12:34:28 EST 2008 x86_64 INI actual : /etc/php5/cli/php.ini More .INIs : /etc/php5/cli/conf.d/curl.ini,/etc/php5/cli/conf.d/gd.ini,/etc/php5/cli/conf.d/gnupg.ini,/etc/php5/cli/conf.d/mcrypt.ini,/etc/php5/cli/conf.d/mysql.ini,/etc/php5/cli/conf.d/mysqli.ini,/etc/php5/cli/conf.d/pdo.ini,/etc/php5/cli/conf.d/pdo_mysql.ini CWD : /var/apache2/sites/gnupg-1.3.2 Extra dirs : ===================================================================== Running selected tests. 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] ===================================================================== Number of tests : 24 12 Tests skipped : 12 ( 50.0%) -------- Tests warned : 0 ( 0.0%) ( 0.0%) Tests failed : 12 ( 50.0%) (100.0%) Tests passed : 0 ( 0.0%) ( 0.0%) --------------------------------------------------------------------- Time taken : 1 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]
它說除了 gnupg(curl、gd、mcrypt、mysql、mysqli、pdo 和 pdo_mysql)之外無法載入的庫列表都存在於 gnupg.so 文件旁邊的擴展目錄中,它們都顯示在 php_info( ),但 gnupg 擴展並沒有顯示在上面。此外,正如您從錯誤中看到的那樣,所有經過測試的 gnupg 函式都失敗了。有沒有人有什麼建議?
解決了。我連結到的演練適用於 Ubuntu 10.04 系統,但顯然不適用於需要它的 Debian 伺服器。我需要安裝一些其他軟體包才能使其正常工作:
- libgpg-error0_1.6-1
- libpth20_2.0.7-16
- libpth-dev_2.0.7-16
- libgpg-error-dev_1.6-1
- libgpgme11_1.2.0-1.2
- libgpgme11-dev_1.2.0-1
所有這些都可以從debian 站點上的軟體包中獲得