xamppでpearの設定で少し嵌ったときの記録 xamppのバージョン:v3.1.0 まず、pear_infoで動作確認をしようとしました。以下のスクリプトを入力し、pearinfo.phpとして保存します。
<?php require_once 'PEAR/Info.php'; $info = new PEAR_Info(); $info->show(); ?>
エラーが出て、表示されません。
一応Pear_Infoをインストールしておきます。
コマンドプロンプトで、以下のコマンドを打ち込みます。
C:\xampp\php>pear install -a Pear_Info
・
・
・
install ok: channel ://pear.php.net/Console_Getrgs-1.3.5
install ok: channel ://pear.php.net/Pear_Info-1.9.2
ずらずらとインストール先を選定しつつ、インストールしましたのメッセージが表示されました。まずは、Pear_Infoのインストールは大丈夫そうです。
そして次の課題。
windows環境にpearをいれるときは、go-pear.bat というバッチファイルが必要との記事を見るが、我がxamppのphp以下のファイルにはそのようなファイルはまったく見当たらないのです。
さらに調べてみると、ここ最近のxamppには同バッチファイルはインストール時に入っていないようです。
その代わりに go-pear.phar というファイルをインストールすると、解決するとの情報がちらほら。
このファイルをダウンロードしました。
このファイルは、C:\xampp\php以下のディレクトリに保存しておきます。
それから、コマンドプロンプトで以下のコマンドを打ち込みます。
C:\xampp\php>pear go-pear.phar
Are you sure installing a system-wide Pear or a local copy?
(system local)[system] : yes
please confirm local copy by typing 'yes' : yes
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) : C:\xampp\php
2. Temporary directory for processing : C:\xampp\php\tmp
3. Temporary directory for downloads : C:\xampp\php\tmp
4. Binaries directory : C:\xampp\php
5. PHP code directory ($php_dir) : C:\xampp\php\pear
6. Documentation directory : C:\xampp\php\docs
7. Data directory : C:\xampp\php\data
8. User-modifiable configuration files directory : C:\xampp\php\cfg
9. Public Web Files directory : C:\xampp\php\www
10. Tests directory : C:\xampp\php\tests
11. Name of configuration file : C:\xampp\php\pear.ini
12. Path to CLI php.exe : C:\xampp\php.
ずらずらとメッセージが並びます。
最後に Thanks for using go-pear!
終わったようです。
そして、最初に作成したphpファイルを再度実行してみます。
すると、次の画面が表示されました。
うまくいったようです。
コマンドプロンプトから操作して、pearのライブラリをインストールできるなんて目からうろこです。
ディレクトリ移動の仕方も、linuxと同じであったというのも新しい発見でした。