パッケージのインストール(install)
パッケージをインストールする方法を確認します。パッケージのインストールには「install」コマンドを使います。
D:¥php>pear help install
pear install [options] [channel/]<package> ...
Installs one or more PEAR packages. You can specify a package to
install in four ways:
"Package-1.0.tgz" : installs from a local file
"http://example.com/Package-1.0.tgz" : installs from
anywhere on the net.
"package.xml" : installs the package described in
package.xml. Useful for testing, or for wrapping a PEAR package in
another package manager such as RPM.
"Package[-version/state][.tar]" : queries your default channel's server
(pear.php.net) and downloads the newest package with
the preferred quality/state (stable).
To retrieve Package version 1.1, use "Package-1.1," to retrieve
Package state beta, use "Package-beta." To retrieve an uncompressed
file, append .tar (make sure there is no file by the same name first)
To download a package from another channel, prefix with the channel name like
"channel/Package"
More than one package may be specified at once. It is ok to mix these
four ways of specifying packages.
Options:
-f, --force
will overwrite newer installed packages
-l, --loose
do not check for recommended dependency version
-n, --nodeps
ignore dependencies, install anyway
-r, --register-only
do not install files, only register the package as installed
-s, --soft
soft install, fail silently, or upgrade if already installed
-B, --nobuild
don't build C extensions
-Z, --nocompress
request uncompressed files when downloading
-R DIR, --installroot=DIR
root directory used when installing files (ala PHP's INSTALL_ROOT), use
packagingroot for RPM
-P DIR, --packagingroot=DIR
root directory used when packaging files, like RPM packaging
--ignore-errors
force install even if there were errors
-a, --alldeps
install all required and optional dependencies
-o, --onlyreqdeps
install all required dependencies
-O, --offline
do not attempt to download any urls or contact channels
-p, --pretend
Only list the packages that would be downloaded
D:¥php>
書式は次の通りです。
pear install [options] [channel/]<package> ...
それでは「Auth_HTTP」パッケージをインストールしてみます。
pear install Auth_HTTP
「Auth_HTTP」パッケージと同時に「Auth」パッケージがもインストールされています。「list」コマンドで確認してみます。
「Auth_HTTP」パッケージ及び「Auth」パッケージが追加されていることが確認できました。
依存するパッケージを合わせてインストール
PEARで提供しているパッケージは他のパッケージを利用するように設計されているものが多くあります。その為、あるパッケージを利用するためには他のパッケージも合わせてインストールしておかなければならない場合があります。
そこでパッケージをインストールする時に、そのパッケージに必要なパッケージをまとめてインストールすることが出来ます。「install」コマンドを実行する時に「-a」オプションを付けた場合は必要なパッケージの全てとオプションのパッケージを全てインストールします。また「-o」オプションを付けた場合には最小限必要なパッケージを全てインストールします。
pear install -a [channel/]<package> ... pear install -o [channel/]<package> ...
実際の例は必要になった時に行います。
( Written by Tatsuo Ikura )
PHPBook