noshi’s diary

ゲームの事、映画やドラマ、思いついた事、プログラミングの事、雑記的なことを書いています

php PEARをインストール その後の設定

次にPHPファイルの中でrequire_onceしたときにPEARでインストールしたパッケージを読み込めるようにPHPのinclude_pathを通しておきます。 php.iniを開いてpearのインストール先をインクルードします。 include_path = ".:/usr/share/pear" さて、ここからがたいへんでした。 ライブラリのpear_Infoをインストールしようとしたところ、次のような警告あり。

pear install pear_info

--------- Did not download optional dependencies: channel://pear.phpunit.de/PHPUnit, use --alldeps to download automatically pear/PEAR_Info requires PEAR Installer (version >= 1.5.4), installed version is 1.4.9 pear/PEAR_Info can optionally use package "channel://pear.phpunit.de/PHPUnit" (version >= 3.1.4) downloading Console_Getargs-1.3.5.tgz ... Starting to download Console_Getargs-1.3.5.tgz (18,207 bytes) ......done: 18,207 bytes install ok: channel://pear.php.net/Console_Getargs-1.3.5 --------- 一行目にダウンロードができなかったとある。その理由はdepedenciesつまり依存関係にあるようだ。 依存関係によるダウンロードができない原因は、現在のpearのバージョンが古い(pearのバージョンが1.5.4以上が必要だが、現在は1.4.9)ということだろう。その次の文章で、Console_Getargsというパッケージが必要な気配がする文もあるが、pearのバージョンアップをする必要があると思われたので、以下を実行。

pear upgrade PEAR

----------- pear/PEAR dependency package "pear/Console_Getopt" downloaded version 1.3.1 is not the recommended version 1.2.3, but may be compatible, use --force to install pear/Archive_Tar requires PEAR Installer (version >= 1.5.4), installed version is 1.4.9 pear/Console_Getopt requires PEAR Installer (version >= 1.8.0), installed version is 1.4.9 downloading Structures_Graph-1.0.4.tgz ... Starting to download Structures_Graph-1.0.4.tgz (30,318 bytes) .........done: 30,318 bytes downloading XML_Util-1.2.1.tgz ... Starting to download XML_Util-1.2.1.tgz (17,729 bytes) ...done: 17,729 bytes upgrade ok: channel://pear.php.net/XML_Util-1.2.1 upgrade ok: channel://pear.php.net/Structures_Graph-1.0.4 ---------- またまた長い文章ですが、 Console_Getopt" downloaded version 1.3.1 is not the recommended version 1.2.3, but may be compatible, use --force to installは、Console_Getoptバージョンについて触れられているようだ。強制的にインストール可能だと。 では、強制インストールを実行。

pear install --force Console_Getopt

------------- warning: pear/Console_Getopt requires PEAR Installer (version >= 1.8.0), installed version is 1.4.9 downloading Console_Getopt-1.3.1.tgz ... Starting to download Console_Getopt-1.3.1.tgz (4,471 bytes) .....done: 4,471 bytes install ok: channel://pear.php.net/Console_Getopt-1.3.1 ------------- インストールが成功 再度、PEARのアップグレードを実行

pear upgrade PEAR

------------- downloading PEAR-1.9.4.tgz ... Starting to download PEAR-1.9.4.tgz (296,332 bytes) .............................................................done: 296,332 bytes upgrade ok: channel://pear.php.net/PEAR-1.9.4 PEAR: Optional feature webinstaller available (PEAR's web-based installer) PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer) PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer) To install use "pear install pear/PEAR#featurename" -------------- もう一度、pear install PEAR_Info PEAR_Infoインストール

pear install PEAR_Info

-------------- Unknown remote channel: pear.phpunit.de Did not download optional dependencies: channel://pear.phpunit.de/PHPUnit, use --alldeps to download automatically pear/PEAR_Info can optionally use package "channel://pear.phpunit.de/PHPUnit" (version >= 3.1.4) downloading PEAR_Info-1.9.2.tgz ... Starting to download PEAR_Info-1.9.2.tgz (60,722 bytes) .........done: 60,722 bytes install ok: channel://pear.php.net/PEAR_Info-1.9.2 -------------- チャネル毎にインストール済みのパッケージ一覧を確認 「-a」オプションを付けて次のように実行。

pear list -a

-------------

Installed packages, channel __uri:

(no packages installed)

Installed packages, channel doc.php.net:

(no packages installed)

Installed packages, channel pear.php.net:

Package Version State Archive_Tar 1.3.10 stable Auth 1.6.4 stable Console_Getargs 1.3.5 stable Console_Getopt 1.3.1 stable PEAR 1.9.4 stable PEAR_Info 1.9.2 stable Structures_Graph 1.0.4 stable XML_RPC 1.5.0 stable XML_Util 1.2.1 stable

Installed packages, channel pecl.php.net:

(no packages installed) ------------- とりあえず使用予定のAuthとPEAR_Infoが入っているのが確認できた。 vi /var/www/html/pearinfo.php <?php require_once 'System.php'; require_once 'PEAR/Info.php'; $info = new PEAR_Info(); $info->show(); ?> :wq 上書き保存して終了 [root@centos]# chmod 755 /var/www/html/pearinfo.php 実行権限付与 ブラウザから http://自分のアドレス/pearinfo.php にアクセス PEARバージョン等が表示されれば成功