PEAR的其他安装方法
如果PHP运行环境自带PEAR,则可以在PHP目录下找到PEAR.DAT文件,双击这个文件即可进行PEAR安装,方式应该类似上述安装方式。同时注意修改PHP.INI中的include_path选项即可。 PEAR命令
在命令行方式下,运用PEAR的相关命令可以安装自己需要的PEAR安装包。
pear help 列出pear的所有命令,类似于pear的命令帮助命令。
pear help <command> 列出某个pear命令的具体信息
pear help shortcuts 列出所有pear命令的简写
pear list-all 列出所有可安装的packages,很多,可以访问pear扩展包列表找到需要的packages,再使用pear install命令安装package。
(安装pear时,可以让其使用默认值,一直回车完。) 接着安装单元测试框架phpunit:
d:\wamp\bin\php\php5.2.5>pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded
d:\wamp\bin\php\php5.2.5>pear install phpunit/PHPUnit
Did not download optional dependencies: pear/Image_GraphViz, pear/Log, channel:/
/pear.symfony-project.com/YAML, use --alldeps to download automatically
phpunit/PHPUnit requires PEAR Installer (version >= 1.8.1), installed version is
1.6.1
phpunit/PHPUnit can optionally use package "pear/Image_GraphViz" (version >= 1.2
.1)
phpunit/PHPUnit can optionally use package "pear/Log"
phpunit/PHPUnit can optionally use package "channel://pear.symfony-project.com/Y
AML" (version >= 1.0.2)
phpunit/PHPUnit can optionally use PHP extension "pdo_sqlite"
phpunit/PHPUnit can optionally use PHP extension "soap"
phpunit/PHPUnit can optionally use PHP extension "xdebug" (version >= 2.0.5)
No valid packages found
install failed
(安装phpunit失败,此时通过pear upgrade pear更新pear后继续安装)