インストール: PEAR/PECL | レガシーなPHPのパッケージマネージャー

PHPのパッケージマネージャーであるPEAR (PHP Extension and Application Repository) をインストールする。
PEARはレガシーなPHPのパッケージマネージャーであり,PHPの黎明期に広く使われたパッケージマネージャーだ。
導入
PEARはPHP製のパッケージのパッケージマネージャーだ。PEARをインストールすることで,C製パッケージのパッケージマネージャーのPECL (PHP Extension Community Library) もインストールされる。PECLはPEARを経由しているので両者には密接な関係がある。
最近のPHPのパッケージマネージャーとしては,Composerの利用が普及してきている。しかし,例えばXdebugのようにComposerに対応していないパッケージもあり,加えて依然としてPHP本体のC言語のモジュールのインストールにはPECLやphpizeを使う必要がある。
PEARとPECLはもともとPHPのソースコードに同梱されており,PHPのソースコードからのビルド時にmake install
の実行時に自動的にインストールされていた。
しかし,2019-02-11のマージコミットでPHP 7.4からデフォルトではインストールされなくなり,インストールに--with-pear
オプションが必要になった (参考: PHP7.4ではPEARがインストールされなくなる – Qiita)。
2020-02-06に最後にPHP 7.3.14をビルドした際は,PEAR/PECLが同梱されていた。しかし,2020-04-11にビルドすると,--with-pear
を指定してもPEAR/PECLがインストールされなくなっていた。
XdebugでPECLが必要になったことと,PHPのソースコードをビルドしてもPEAR/PECLがインストールされなくなったため,PEAR/PECLのインストール方法を改めて今回整理した。
手順
項目 | 説明 |
---|---|
配布元 | PEAR – PHP Extension and Application Repository |
リポジトリー | pear/pear-core: This is the definitive source of PEAR’s core files. |
手順 | |
依存情報 | pear-core/INSTALL at master · pear/pear-core |
依存先 (必須) | PHP, PHP extension XML |
依存先 (任意) | expect, PHP extension: zlib, xdebug |
依存元 |
sh -eux <<-"EOT"
LOCAL=~/.local
mkdir -p "$LOCAL/src"
cd "$LOCAL/src"
[ -e go-pear.phar ] || wget https://pear.php.net/go-pear.phar
if ! command -v expect >/dev/null; then
php go-pear.phar # press enter
else
expect <<-EOC
set timeout 5
spawn php go-pear.phar
expect 1-12; send 2\n; expect :; send $HOME/tmp/pear/install\n;
expect 1-12; send 3\n; expect :; send $HOME/tmp/pear/download\n;
expect 1-12; send \n;
expect Y/n; send n\n
EOC
fi
unset PHP_PEAR_INSTALL_DIR
PEAR=~/pear/bin/pear
TMP_DIR="$LOCAL/tmp/pear"
$PEAR config-set temp_dir "$TMP_DIR/tmp"
$PEAR config-set download_dir "$TMP_DIR/download"
$PEAR config-set cache_dir "$TMP_DIR/cache"
PEAR_DIR="$LOCAL/stow/pear"
$PEAR config-set bin_dir "$PEAR_DIR/bin"
$PEAR config-set man_dir "$PEAR_DIR/share/man"
PHP_DIR="$PEAR_DIR/lib/php"
$PEAR config-set php_dir "$PHP_DIR"
$PEAR config-set doc_dir "$PHP_DIR/doc"
$PEAR config-set data_dir "$PHP_DIR/data"
$PEAR config-set cfg_dir "$PHP_DIR/cfg"
$PEAR config-set www_dir "$PHP_DIR/htdocs"
$PEAR config-set test_dir "$PHP_DIR/test"
$PEAR install -f pear
stow -Rd $LOCAL/stow pear
pear channel-update pear.php.net
pecl channel-update pecl.php.net
rm -rf ~/pear
EOT
日付 | バージョン | OS | 依存関係 |
---|---|---|---|
2020-04-11 | 1.10.10 | Ubuntu 18.04 | PHP 7.3.3 |
今回はPHPとは独立した $HOME/.local/stow/pear
配下にインストールした。今後,PEARでパッケージをインストールした場合,新規追加ファイルを反映させるため以下のコマンドでstow
コマンドを実行し直す。
stow -Rd ~/.local/stow pear
なお,PECLでパッケージをインストールした場合については,自動的に使用しているPHPのext_dir
(例: ~/.local/lib/php/extensions/debug-non-zts-20180731/
)に配置されるため,何もしなくても特に問題ないだろう。
依存関係の内,zlib以外のXMLとxdebugはマニュアルでは明記されていない。「PEAR」配下をextension_loaded
で検索するとヒットした依存関係だ。
説明
Gitリポジトリーからのビルドは少々情報が少なく,難易度が高そうだった。その他,「pear-core/INSTALL at master · pear/pear-core」によれば,PHPのソースコードからのビルド時に,--with-pear
を指定すれば,make install
の実行時にPEARも一緒にインストールしてくれると書いてある。しかし,インストールされなかった。そのため,一般的に推奨されているインストール方法であるgo-pear.phar
を使う方法を記した。
php go-pear.phar
の実行後に,以下の画面が表示されPEARのインストール先を対話的に指定する。
Below is a suggested file layout for your new PEAR installation. To change individual locations, type the number in front of the directory. Type 'all' to change all of them or simply press Enter to accept these locations. 1. Installation base ($prefix) : /home/senooken/pear 2. Temporary directory for processing : /tmp/pear/install 3. Temporary directory for downloads : /tmp/pear/install 4. Binaries directory : /home/senooken/pear/bin 5. PHP code directory ($php_dir) : /home/senooken/pear/share/pear 6. Documentation directory : /home/senooken/pear/docs 7. Data directory : /home/senooken/pear/data 8. User-modifiable configuration files directory : /home/senooken/pear/cfg 9. Public Web Files directory : /home/senooken/pear/www 10. System manual pages directory : /home/senooken/pear/man 11. Tests directory : /home/senooken/pear/tests 12. Name of configuration file : /home/senooken/.pearrc 1-12, 'all' or Enter to continue:
PEARのインストールでは,このインストール先の設定が少々やっかいだった。そこで,以下の手順でインストール先を設定した。
- 初回はデフォルトのままインストール
- インストール直後に
pear config-set
で設定をPHP同梱のPEARと同じ設定に変更 - インストールした
pear
を使ってpear install pear
でPEAR/PECLを再インストール - 最初にインストールしたPEAR (
~/pear
) を削除
そのため,上記の対話画面はEnterを入力して,デフォルトのままインストールを進める。expect
コマンドがインストールされていれば,上記のコマンドで自動的に入力される。そうでなければ,やや手間だが手動で入力する。go-pear.phar
はヒアドキュメントに対応していないため,こうするしかなかった。
なお,レンタルサーバーでは初回インストール時のtemp_dirとdownload_dir (/tmp/pear/install
) とが使えないというエラーが出たため,ここだけ設定している。
なお,初回インストール時にphp.ini
が存在すると,include_pathに今回のインストール先を追加しようと以下の内容で確認してくる。
WARNING! The include_path defined in the currently used php.ini does not contain the PEAR PHP directory you just specified: </home/senooken/pear/share/pear> If the specified directory is also not in the include_path used by your scripts, you will have problems getting any PEAR packages working. Would you like to alter php.ini </home/senooken/.local/etc/php.ini>? [Y/n] :
インストール直後に,PHPのインストール時に設定したinclude_pathのディレクトリー構成に変更するため,追加は不要だ。そのため,ここはnを入力する。
設定
pearコマンドやpeclコマンドは以下のシェルスクリプトとなっている。
pear
コマンドの中身#!/bin/sh
# first find which PHP binary to use
if test "x$PHP_PEAR_PHP_BIN" != "x"; then
PHP="$PHP_PEAR_PHP_BIN"
else
if test "/home/senooken/.local/stow/php-7.3.3/bin/php" = '@'php_bin'@'; then
PHP=php
else
PHP="/home/senooken/.local/stow/php-7.3.3/bin/php"
fi
fi
# then look for the right pear include dir
if test "x$PHP_PEAR_INSTALL_DIR" != "x"; then
INCDIR=$PHP_PEAR_INSTALL_DIR
INCARG="-d include_path=$PHP_PEAR_INSTALL_DIR"
else
if test "/home/senooken/.local/stow/pear/lib/php" = '@'php_dir'@'; then
INCDIR=`dirname $0`
INCARG=""
else
INCDIR="/home/senooken/.local/stow/pear/lib/php"
INCARG="-d include_path=/home/senooken/.local/stow/pear/lib/php"
fi
fi
exec $PHP -C -q $INCARG -d date.timezone=UTC -d output_buffering=1 -d variables_order=EGPCS -d open_basedir="" -d safe_mode=0 -d register_argc_argv="On" -d auto_prepend_file="" -d auto_append_file="" $INCDIR/pearcmd.php "$@"
冒頭でPHP_PEAR_PHP_BIN
環境変数で使用するphpコマンド,PHP_PEAR_INSTALL_DIR
環境変数で使用するinclude_path
をを判定している。環境変数が設定されていなければ,インストール時のPHPの情報がフルパスで参照される。
フルパスで参照されるため,何もしなければインストール時のPHP専用のPEAR/PECLとなってしまう。PHPのバージョンが変わっても使用可能なように,$HOME/.bashrc
や$HOME/.profile
でこれらの環境変数を以下の値で設定しておく。
export PHP_PEAR_PHP_BIN=php PHP_PEAR_INSTALL_DIR=~/.local/lib/php
なお,pearを一度アンインストールしてから再インストールする場合,PHP_PEAR_INSTALL_DIR
の参照が不正になってpearコマンドの実行時に以下のエラーが出てしまった。
Could not open input file: /home/senooken/.local/lib/php/pearcmd.php
そのため,インストール時はPHP_PEAR_INSTALL_DIR
環境変数を解除している。
その他,PEAR/PECLを使う上で最低限必要なOpenSSLの設定があるので,「PEAR/PECLに最低限必要なphp.iniの設定 – senooken.jp」や「PHPのSSL通信に必要な証明書ファイルの入手方法」を参考にする。
また,PEAR/PECLの初回実行時に以下の警告が表示される。
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
WARNING: channel "pecl.php.net" has updated its protocols, use "pecl channel-update pecl.php.net" to update
以下のコマンドでチャンネルを更新して警告を回避する。
pear channel-update pear.php.net
pecl channel-update pecl.php.net
PEARのインストール先の指定
php go-pear.phar
実行時に指定するインストール先が後々重要になってくるので,検討した。PEARはPHPのライブラリーであるため,PHPのパスとの整合性が重要だからだ。
そのために,まず過去のPHPのソースコードに同梱されていたPEARとgo-pear.phar
のデフォルトでインストールした場合の設定を確認した。以下にそれぞれの設定値を記す。
pear config-show
の実行結果CONFIGURATION (CHANNEL PEAR.PHP.NET): ===================================== Auto-discover new Channels auto_discover <not set> Default Channel default_channel pear.php.net HTTP Proxy Server Address http_proxy <not set> PEAR server [DEPRECATED] master_server pear.php.net Default Channel Mirror preferred_mirror pear.php.net Remote Configuration File remote_config <not set> PEAR executables directory bin_dir /home/senooken/.local/stow/php-7.3.3/bin PEAR documentation directory doc_dir /home/senooken/.local/stow/php-7.3.3/lib/php/doc PHP extension directory ext_dir /home/senooken/.local/stow/php-7.3.3/lib/php/extensions/debug-non-zts-20180731 PEAR directory php_dir /home/senooken/.local/stow/php-7.3.3/lib/php PEAR Installer cache directory cache_dir /tmp/pear/cache PEAR configuration file cfg_dir /home/senooken/.local/stow/php-7.3.3/lib/php/cfg directory PEAR data directory data_dir /home/senooken/.local/stow/php-7.3.3/lib/php/data PEAR Installer download download_dir /tmp/pear/download directory Systems manpage files man_dir /home/senooken/.local/stow/php-7.3.3/lib/php/local/man directory PEAR metadata directory metadata_dir <not set> PHP CLI/CGI binary php_bin /home/senooken/.local/stow/php-7.3.3/bin/php php.ini location php_ini <not set> --program-prefix passed to php_prefix <not set> PHP's ./configure --program-suffix passed to php_suffix <not set> PHP's ./configure PEAR Installer temp directory temp_dir /tmp/pear/temp PEAR test directory test_dir /home/senooken/.local/stow/php-7.3.3/lib/php/test PEAR www files directory www_dir /home/senooken/.local/stow/php-7.3.3/lib/php/htdocs Cache TimeToLive cache_ttl 3600 Preferred Package State preferred_state stable Unix file mask umask 22 Debug Log Level verbose 1 PEAR password (for password <not set> maintainers) Signature Handling Program sig_bin /usr/bin/gpg Signature Key Directory sig_keydir /home/senooken/.local/stow/php-7.3.3/etc/pearkeys Signature Key Id sig_keyid <not set> Package Signature Type sig_type gpg PEAR username (for username <not set> maintainers) User Configuration File Filename /home/senooken/.pearrc System Configuration File Filename /home/senooken/.local/stow/php-7.3.3/etc/pear.conf
pear config-show
の実行結果CONFIGURATION (CHANNEL PEAR.PHP.NET): ===================================== Auto-discover new Channels auto_discover <not set> Default Channel default_channel pear.php.net HTTP Proxy Server Address http_proxy <not set> PEAR server [DEPRECATED] master_server pear.php.net Default Channel Mirror preferred_mirror pear.php.net Remote Configuration File remote_config <not set> PEAR executables directory bin_dir /home/senooken/pear/bin PEAR documentation directory doc_dir /home/senooken/pear/docs PHP extension directory ext_dir /home/senooken/.local/stow/php-7.3.4/lib/php/extensions/debug-zts-20180731 PEAR directory php_dir /home/senooken/pear/share/pear PEAR Installer cache directory cache_dir /tmp/pear/cache PEAR configuration file cfg_dir /home/senooken/pear/cfg directory PEAR data directory data_dir /home/senooken/pear/data PEAR Installer download download_dir /tmp/pear/install directory Systems manpage files man_dir /home/senooken/pear/man directory PEAR metadata directory metadata_dir <not set> PHP CLI/CGI binary php_bin /home/senooken/.local/stow/php-7.3.4/bin/php php.ini location php_ini <not set> --program-prefix passed to php_prefix <not set> PHP's ./configure --program-suffix passed to php_suffix <not set> PHP's ./configure PEAR Installer temp directory temp_dir /tmp/pear/install PEAR test directory test_dir /home/senooken/pear/tests PEAR www files directory www_dir /home/senooken/pear/www Cache TimeToLive cache_ttl 3600 Preferred Package State preferred_state stable Unix file mask umask 22 Debug Log Level verbose 1 PEAR password (for password <not set> maintainers) Signature Handling Program sig_bin /usr/bin/gpg Signature Key Directory sig_keydir /home/senooken/.local/stow/php-7.3.4/etc/pearkeys Signature Key Id sig_keyid <not set> Package Signature Type sig_type gpg PEAR username (for username <not set> maintainers) User Configuration File Filename /home/senooken/.pearrc System Configuration File Filename /home/senooken/.local/stow/php-7.3.4/etc/pear.conf
上記の値と,これを踏まえた今回の設定値を以下の表に整理した。
ID | 項目 | PHP同梱版 | go-pear.phar | 設定値 |
---|---|---|---|---|
01 | prefix | $HOME/.local/stow/php-x.x.x | $HOME/pear | $HOME/.local/stow/pear |
02 | temp_dir | /tmp/pear/tmp | /tmp/pear/install | $HOME/.local/tmp/pear/tmp |
03 | download_dir | /tmp/pear/download | /tmp/pear/install | $HOME/.local/tmp/pear/download |
04 | bin_dir | bin | bin | |
05 | php_dir | lib/php | share/pear | $prefix/lib/php |
06 | doc_dir | lib/php/doc | docs | $php_dir/doc |
07 | data_dir | lib/php/data | data | $php_dir/data |
08 | cfg_dir | lib/php/cfg | cfg | $php_dir/cfg |
09 | www_dir | lib/php/htdocs | www | $php_dir/htdocs |
10 | man_dir | lib/php/local/man | man | $prefix/share/man |
11 | test_dir | lib/php/test | tests | $php_dir/test |
12 | .pearrc | $HOME/.pearrc | $HOME/.pearrc | |
cache_dir | /tmp/pear/cache | /tmp/pear/cache | $HOME/.local/tmp/pear/cache |
IDはphp go-pear.phar
の実行後に表示される対話画面の項目に対応している。
なお,設定値を強調した01. prefix, 05. php_dir, 06. doc_dir, 07. data_dir, 11. test_dirはPEARのインストール時にファイルが配置される。
PEAR/PECLで管理するパッケージは01. prefix
に指定したディレクトリーに格納される。ここを基準に残りのディレクトリーが基本的に決まる。次に重要なのが,05. php_dirだ。ここにPHP関係のファイルがインストールされる。
ただ,05-10までのディレクトリー構成がPHP同梱のPEARとgo-pear.phar
のものとで異なっており困惑した。
今回インストールするPEAR/PECLで管理するパッケージは,PHPとは独立した場所 ($HOME/.local/stow/pear
)にインストールすることにした。そうしないと,バージョンごとにインストールをやり直す必要があり,パッケージのアンインストールがしにくいからだ。
インストール手順では [設定値] 列に値のあるものを,pear config-set
コマンドによりインストール直後に設定している。。02-03やcache_dirの/tmp
はレンタルサーバーだとディレクトリーを作成できなかったので,ローカル環境に指定した。
PEARのインストール後に生成される~/.pearrc
は以下となった。
#PEAR_Config 0.9
a:13:{s:15:"preferred_state";s:6:"stable";s:8:"temp_dir";s:34:"/home/senooken/.local/tmp/pear/tmp";s:12:"download_dir";s:39:"/home/senooken/.local/tmp/pear/download";s:7:"bin_dir";s:35:"/home/senooken/.local/stow/pear/bin";s:7:"php_dir";s:39:"/home/senooken/.local/stow/pear/lib/php";s:7:"doc_dir";s:43:"/home/senooken/.local/stow/pear/lib/php/doc";s:8:"data_dir";s:44:"/home/senooken/.local/stow/pear/lib/php/data";s:7:"cfg_dir";s:43:"/home/senooken/.local/stow/pear/lib/php/cfg";s:7:"www_dir";s:46:"/home/senooken/.local/stow/pear/lib/php/htdocs";s:7:"man_dir";s:41:"/home/senooken/.local/stow/pear/share/man";s:8:"test_dir";s:44:"/home/senooken/.local/stow/pear/lib/php/test";s:10:"__channels";a:3:{s:5:"__uri";a:0:{}s:11:"doc.php.net";a:0:{}s:12:"pecl.php.net";a:0:{}}s:9:"cache_dir";s:36:"/home/senooken/.local/tmp/pear/cache";}
加えて,PEARのインストール後にPHP_INI_SCAN_DIR
環境変数で指定していた~/.local/etc/
にphp.ini
が存在しない場合,以下の内容で生成されていた。
[PHP]
error_reporting = E_ERROR | E_RECOVERABLE_ERROR
[Session]
session.save_path = "$HOME/.local/var/lib/php/sessions"
最後にインストール先を指定してインストールしたpearでのpear config-show
の実行結果を以下に示す。
pear config-show
の実行結果CONFIGURATION (CHANNEL PEAR.PHP.NET): ===================================== Auto-discover new Channels auto_discover <not set> Default Channel default_channel pear.php.net HTTP Proxy Server Address http_proxy <not set> PEAR server [DEPRECATED] master_server pear.php.net Default Channel Mirror preferred_mirror pear.php.net Remote Configuration File remote_config <not set> PEAR executables directory bin_dir /home/senooken/.local/stow/pear/bin PEAR documentation directory doc_dir /home/senooken/.local/stow/pear/lib/php/doc PHP extension directory ext_dir /home/senooken/.local/stow/php-7.3.3/lib/php/extensions/debug-non-zts-20180731 PEAR directory php_dir /home/senooken/.local/stow/pear/lib/php PEAR Installer cache directory cache_dir /home/senooken/.local/tmp/pear/cache PEAR configuration file cfg_dir /home/senooken/.local/stow/pear/lib/php/cfg directory PEAR data directory data_dir /home/senooken/.local/stow/pear/lib/php/data PEAR Installer download download_dir /home/senooken/.local/tmp/pear/download directory Systems manpage files man_dir /home/senooken/.local/stow/pear/share/man directory PEAR metadata directory metadata_dir <not set> PHP CLI/CGI binary php_bin /home/senooken/.local/stow/php-7.3.3/bin/php php.ini location php_ini <not set> --program-prefix passed to php_prefix <not set> PHP's ./configure --program-suffix passed to php_suffix <not set> PHP's ./configure PEAR Installer temp directory temp_dir /home/senooken/.local/tmp/pear/tmp PEAR test directory test_dir /home/senooken/.local/stow/pear/lib/php/test PEAR www files directory www_dir /home/senooken/.local/stow/pear/lib/php/htdocs Cache TimeToLive cache_ttl 3600 Preferred Package State preferred_state stable Unix file mask umask 22 Debug Log Level verbose 1 PEAR password (for password <not set> maintainers) Signature Handling Program sig_bin /usr/bin/gpg Signature Key Directory sig_keydir /home/senooken/.local/stow/php-7.3.3/etc/pearkeys Signature Key Id sig_keyid <not set> Package Signature Type sig_type gpg PEAR username (for username <not set> maintainers) User Configuration File Filename /home/senooken/.pearrc System Configuration File Filename /home/senooken/.local/stow/php-7.3.3/etc/pear.conf
少々長くなったが,このあたりの設定を記したことで今後の参考になるだろう。
デフォルトのPEARのインストール内容
試行錯誤中にPHPと同じ場所にPEARをインストールしたり,アンインストールした。参考情報として,その際の情報を掲載する。
まず,go-pear.phar
でデフォルトでインストールされたファイルは以下となっていた。
cd ~/pear
find . -type f >list.log
./bin/peardev ./bin/pecl ./bin/pear ./docs/Archive_Tar/docs/Archive_Tar.txt ./docs/PEAR/README.rst ./docs/PEAR/INSTALL ./docs/PEAR/LICENSE ./docs/XML_Util/examples/example2.php ./docs/XML_Util/examples/example.php ./docs/Structures_Graph/docs/tutorials/Structures_Graph/Structures_Graph.pkg ./docs/Structures_Graph/LICENSE ./data/PEAR/package.dtd ./data/PEAR/template.spec ./share/pear/peclcmd.php ./share/pear/.registry/console_getopt.reg ./share/pear/.registry/xml_util.reg ./share/pear/.registry/archive_tar.reg ./share/pear/.registry/pear.reg ./share/pear/.registry/structures_graph.reg ./share/pear/Console/Getopt.php ./share/pear/Archive/Tar.php ./share/pear/.lock ./share/pear/.filemap ./share/pear/OS/Guess.php ./share/pear/.depdb ./share/pear/PEAR/RunTest.php ./share/pear/PEAR/Downloader/Package.php ./share/pear/PEAR/Installer/Role.php ./share/pear/PEAR/Installer/Role/Cfg.xml ./share/pear/PEAR/Installer/Role/Script.php ./share/pear/PEAR/Installer/Role/Cfg.php ./share/pear/PEAR/Installer/Role/Www.xml ./share/pear/PEAR/Installer/Role/Common.php ./share/pear/PEAR/Installer/Role/Ext.xml ./share/pear/PEAR/Installer/Role/Src.xml ./share/pear/PEAR/Installer/Role/Test.php ./share/pear/PEAR/Installer/Role/Man.xml ./share/pear/PEAR/Installer/Role/Src.php ./share/pear/PEAR/Installer/Role/Man.php ./share/pear/PEAR/Installer/Role/Script.xml ./share/pear/PEAR/Installer/Role/Data.php ./share/pear/PEAR/Installer/Role/Doc.php ./share/pear/PEAR/Installer/Role/Php.xml ./share/pear/PEAR/Installer/Role/Www.php ./share/pear/PEAR/Installer/Role/Php.php ./share/pear/PEAR/Installer/Role/Test.xml ./share/pear/PEAR/Installer/Role/Ext.php ./share/pear/PEAR/Installer/Role/Data.xml ./share/pear/PEAR/Installer/Role/Doc.xml ./share/pear/PEAR/XMLParser.php ./share/pear/PEAR/Installer.php ./share/pear/PEAR/REST.php ./share/pear/PEAR/Proxy.php ./share/pear/PEAR/Config.php ./share/pear/PEAR/ChannelFile.php ./share/pear/PEAR/Packager.php ./share/pear/PEAR/Command.php ./share/pear/PEAR/Common.php ./share/pear/PEAR/Dependency2.php ./share/pear/PEAR/Frontend.php ./share/pear/PEAR/ErrorStack.php ./share/pear/PEAR/ChannelFile/Parser.php ./share/pear/PEAR/Validator/PECL.php ./share/pear/PEAR/REST/11.php ./share/pear/PEAR/REST/13.php ./share/pear/PEAR/REST/10.php ./share/pear/PEAR/DependencyDB.php ./share/pear/PEAR/Exception.php ./share/pear/PEAR/Downloader.php ./share/pear/PEAR/Builder.php ./share/pear/PEAR/Validate.php ./share/pear/PEAR/Registry.php ./share/pear/PEAR/Frontend/CLI.php ./share/pear/PEAR/Command/Build.xml ./share/pear/PEAR/Command/Pickle.php ./share/pear/PEAR/Command/Channels.php ./share/pear/PEAR/Command/Channels.xml ./share/pear/PEAR/Command/Remote.xml ./share/pear/PEAR/Command/Config.php ./share/pear/PEAR/Command/Mirror.php ./share/pear/PEAR/Command/Pickle.xml ./share/pear/PEAR/Command/Registry.xml ./share/pear/PEAR/Command/Common.php ./share/pear/PEAR/Command/Test.php ./share/pear/PEAR/Command/Mirror.xml ./share/pear/PEAR/Command/Auth.xml ./share/pear/PEAR/Command/Package.xml ./share/pear/PEAR/Command/Config.xml ./share/pear/PEAR/Command/Remote.php ./share/pear/PEAR/Command/Install.php ./share/pear/PEAR/Command/Install.xml ./share/pear/PEAR/Command/Auth.php ./share/pear/PEAR/Command/Registry.php ./share/pear/PEAR/Command/Test.xml ./share/pear/PEAR/Command/Package.php ./share/pear/PEAR/Command/Build.php ./share/pear/PEAR/Task/Unixeol.php ./share/pear/PEAR/Task/Unixeol/rw.php ./share/pear/PEAR/Task/Replace/rw.php ./share/pear/PEAR/Task/Common.php ./share/pear/PEAR/Task/Postinstallscript.php ./share/pear/PEAR/Task/Windowseol.php ./share/pear/PEAR/Task/Postinstallscript/rw.php ./share/pear/PEAR/Task/Windowseol/rw.php ./share/pear/PEAR/Task/Replace.php ./share/pear/PEAR/PackageFile/v1.php ./share/pear/PEAR/PackageFile/v2.php ./share/pear/PEAR/PackageFile/v2/Validator.php ./share/pear/PEAR/PackageFile/v2/rw.php ./share/pear/PEAR/PackageFile/Parser/v1.php ./share/pear/PEAR/PackageFile/Parser/v2.php ./share/pear/PEAR/PackageFile/Generator/v1.php ./share/pear/PEAR/PackageFile/Generator/v2.php ./share/pear/PEAR/PackageFile.php ./share/pear/.depdblock ./share/pear/Structures/Graph/Manipulator/TopologicalSorter.php ./share/pear/Structures/Graph/Manipulator/AcyclicTest.php ./share/pear/Structures/Graph/Node.php ./share/pear/Structures/Graph.php ./share/pear/XML/Util.php ./share/pear/.channels/pear.php.net.reg ./share/pear/.channels/.alias/pecl.txt ./share/pear/.channels/.alias/phpdocs.txt ./share/pear/.channels/.alias/pear.txt ./share/pear/.channels/__uri.reg ./share/pear/.channels/doc.php.net.reg ./share/pear/.channels/pecl.php.net.reg ./share/pear/PEAR.php ./share/pear/pearcmd.php ./share/pear/System.php ./tests/Console_Getopt/tests/bug11068.phpt ./tests/Console_Getopt/tests/bug10557.phpt ./tests/Console_Getopt/tests/bug13140.phpt ./tests/Console_Getopt/tests/001-getopt.phpt ./tests/XML_Util/tests/ReverseEntitiesTests.php ./tests/XML_Util/tests/Bug4950Tests.php ./tests/XML_Util/tests/GetDocTypeDeclarationTests.php ./tests/XML_Util/tests/ApiVersionTests.php ./tests/XML_Util/tests/CreateTagFromArrayTests.php ./tests/XML_Util/tests/CollapseEmptyTagsTests.php ./tests/XML_Util/tests/CreateCommentTests.php ./tests/XML_Util/tests/Bug21177Tests.php ./tests/XML_Util/tests/AbstractUnitTests.php ./tests/XML_Util/tests/CreateStartElementTests.php ./tests/XML_Util/tests/GetXmlDeclarationTests.php ./tests/XML_Util/tests/IsValidNameTests.php ./tests/XML_Util/tests/ReplaceEntitiesTests.php ./tests/XML_Util/tests/Bug5392Tests.php ./tests/XML_Util/tests/CreateEndElementTests.php ./tests/XML_Util/tests/RaiseErrorTests.php ./tests/XML_Util/tests/CreateTagTests.php ./tests/XML_Util/tests/SplitQualifiedNameTests.php ./tests/XML_Util/tests/Bug21184Tests.php ./tests/XML_Util/tests/CreateCDataSectionTests.php ./tests/XML_Util/tests/Bug18343Tests.php ./tests/XML_Util/tests/AttributesToStringTests.php ./tests/Structures_Graph/tests/AcyclicTestTest.php ./tests/Structures_Graph/tests/helper.inc ./tests/Structures_Graph/tests/TopologicalSorterTest.php ./tests/Structures_Graph/tests/AllTests.php ./tests/Structures_Graph/tests/BasicGraphTest.php
万が一,PHPと同じ場所にインストールした場合,上記の内容をlist.logに格納して,PHPのインストールディレクトリーで以下のコマンドで削除すればよいだろう。
sed 's@^\./.[^/]*.[^/]*/@@' list.log | while read -r line; do
find . -path \*"$line" -exec rm {} +
done
go-pear.pharでインストールする際は,PHP標準とはディレクトリー構成が違うことに注意する。php_dirのディレクトリーの構造が2段階 (share/pear
) になっているので,sed
でディレクトリーを2段階 (./share/pear/
まで) 削除してからfind
コマンドで該当するパスを検索して一括で削除している。
XML Extension not found
Amazon Linux 2のyumでインストールしたPHPを使ってPEAR/PECLをインストールしようとすると,以下のエラーが出てしまった。
Beginning install... XML Extension not found
PEAR/XMLParser.phpでPHPにXML拡張機能が必要だったらしい。PHPのXML拡張機能はデフォルトで有効になっているのだが,Amazon Linux 2のPHPは最小構成になっているようで,XMLが無効になっているのが原因のようだ。
PEARのマニュアルには一切記載がなかったので,エラーが出て困惑した。しかたないので,PHPをソースコードからビルドするか,PHPのXML拡張機能をyumなどでインストールする。
“インストール: PEAR/PECL | レガシーなPHPのパッケージマネージャー” に対して1件のコメントがあります。