leopardにpearをインストール&設定 2009 年 4 月 11 日

まずはユーザーのHOMEディレクトリに移動して、localディレクトリを作成

$cd ~
$mkdir local

pearをインストール
curlでPEARのインストーラーをGETして、コマンドラインでgo-pear.phpを実行

$ curl http://pear.php.net/go-pear > go-pear.php
$ php go-pear.php

Welcome to go-pear!

Go-pear will install the ‘pear’ command and all the files needed by
it. This command is your tool for PEAR installation and maintenance.

Go-pear also lets you download and install the following optional PEAR
packages: PEAR_Frontend_Web-beta, PEAR_Frontend_Gtk2, MDB2.

If you wish to abort, press Control-C now, or press Enter to continue:
HTTP proxy (http://user:password@proxy.myhost.com:port), or Enter for none::

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 prefix ($prefix) : /Users/***
2. Temporary files directory : $prefix/temp
3. Binaries directory : $prefix/bin
4. PHP code directory ($php_dir) : $prefix/PEAR
5. Documentation base directory : $php_dir/docs
6. Data base directory : $php_dir/data
7. Tests base directory : $php_dir/tests

//localディレクトリにインストールするため1を選択
1-7, ‘all’ or Enter to continue: 1
Installation prefix ($prefix) [/Users/***] : /Users/***/local

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 prefix ($prefix) : /Users/***/local
2. Temporary files directory : $prefix/temp
3. Binaries directory : $prefix/bin
4. PHP code directory ($php_dir) : $prefix/PEAR
5. Documentation base directory : $php_dir/docs
6. Data base directory : $php_dir/data
7. Tests base directory : $php_dir/tests

//エンター押下
1-7, ‘all’ or Enter to continue:

The following PEAR packages are bundled with PHP: PEAR_Frontend_Web-beta,
PEAR_Frontend_Gtk2, MDB2.
Would you like to install these as well? [Y/n] : Y

//nを押下
Would you like to alter php.ini ? [Y/n] : n

I will add a workaround for this in the ‘pear’ command to make sure
the installer works, but please look over your php.ini or Apache
configuration to make sure /Users/***/local/PEAR is in your include_path.

Current include path : .:
Configured directory : /Users/***/local/PEAR
Currently used php.ini (guess) : /private/etc/php.ini
Press Enter to continue: [Enter]

The ‘pear’ command is now at your service at /Users/***/local/bin/pear

** The ‘pear’ command is not currently in your PATH, so you need to
** use ‘/Users/***/local/bin/pear’ until you have added
** ‘/Users/***/local/bin’ to your PATH environment variable.

Run it without parameters to see the available actions, try ‘pear list’
to see what packages are installed, or ‘pear help’ for help.

For more information about PEAR, see:

http://pear.php.net/faq.php
http://pear.php.net/manual/

Thanks for using go-pear!

go-pear.phpは必要ないので削除

$ rm -rf go-pear.php

インストールしたデータの存在確認

$ ls -l local/
drwxr-xr-x 27 *** staff 918 4 11 13:31 PEAR
drwxr-xr-x 5 *** staff 170 4 11 13:31 bin

pearコマンドを使うためにパスを通す必要がある

$ vim .bash_profile
export PATH=$PATH:/Users/***/local/bin/:$PATH

を追加。

pearの確認

$ pear config-show

Configuration (channel pear.php.net):
=====================================
Auto-discover new Channels auto_discover


pearのインストール完了!

関連する記事:

Leave a Reply