CentOS-5でディストリ標準のphpのを利用している。
php-pearパッケージのpearコマンドでPEARパッケージをいくつか追加している。
バージョンが古いのはご愛嬌。
# pear list Installed packages, channel pear.php.net: ========================================= Package Version State Archive_Tar 1.3.1 stable Calendar 0.5.5 beta Console_Getopt 1.2 stable DB 1.7.14 stable HTML_Common 1.2.5 stable HTML_QuickForm 3.2.13 stable HTTP_Client 1.2.1 stable HTTP_Request 1.4.4 stable MDB2 2.4.1 stable MDB2_Driver_pgsql 1.4.1 stable Net_Socket 1.0.10 stable Net_URL 1.0.15 stable PEAR 1.4.9 stable Pager 2.4.8 stable Services_JSON 1.0.3 stable Structures_Graph 1.0.4 stable XML_RPC 1.5.0 stable XML_Util 1.2.1 stable
rpmのphp-pearでは、/usr/share/pear の下にPEAR関連のファイルが格納される。
/usr/share/pear/.registry の中に、pear list の表示内容と対応するように見えるファイルが存在する。
# ls -l /usr/share/pear/.registry 合計 584 -rw-r--r-- 1 root root 4864 2月 24 2012 archive_tar.reg -rw-r--r-- 1 root root 55040 11月 16 2011 calendar.reg -rw-r--r-- 1 root root 2443 2月 24 2012 console_getopt.reg -rw-r--r-- 1 root root 32831 4月 18 2013 db.reg -rw-r--r-- 1 root root 7430 1月 3 2012 html_common.reg -rw-r--r-- 1 root root 88885 3月 6 2012 html_quickform.reg -rw-r--r-- 1 root root 9458 8月 11 2011 http_client.reg -rw-r--r-- 1 root root 17590 8月 11 2011 http_request.reg -rw-r--r-- 1 root root 94128 9月 10 2013 mdb2.reg -rw-r--r-- 1 root root 28109 9月 10 2013 mdb2_driver_pgsql.reg -rw-r--r-- 1 root root 4224 8月 11 2011 net_socket.reg -rw-r--r-- 1 root root 10726 8月 11 2011 net_url.reg -rw-r--r-- 1 root root 37210 10月 2 2011 pager.reg -rw-r--r-- 1 root root 71397 2月 24 2012 pear.reg -rw-r--r-- 1 root root 6400 11月 19 2011 services_json.reg -rw-r--r-- 1 root root 19434 3月 6 2012 structures_graph.reg -rw-r--r-- 1 root root 27265 2月 24 2012 xml_rpc.reg -rw-r--r-- 1 root root 25171 3月 6 2012 xml_util.reg
.registry をリネームして pear list を実行すると、インストールされたパッケージはないと表示される。
# mv /usr/share/pear/.registry /usr/share/pear/.registry_xxx # pear list (no packages installed from channel pear.php.net)
このとき .registry のディレクトリが作成されている。中は空である。
# ls -ld /usr/share/pear/.registry drwxr-xr-x 2 root root 4096 3月 14 14:13 /usr/share/pear/.registry # ls -l /usr/share/pear/.registry 合計 0
リネームした .registry を元にもどせば、pear list の内容も元に戻る。
# rmdir /usr/share/pear/.registry # mv /usr/share/pear/.registry_xxx /usr/share/pear/.registry # pear list Installed packages, channel pear.php.net: ========================================= Package Version State Archive_Tar 1.3.1 stable Calendar 0.5.5 beta Console_Getopt 1.2 stable ...(略)
※pear list 実行時に作成された空の .registry を削除せずに、
mv /usr/share/pear/.registry_xxx /usr/share/pear/.registry を実行すると
/usr/share/pear/.registry/.registry に移動してしまう。
結果 pear list を実行しても no packages installed になる。
当初これにはまってしまい焦った。