windows下安装pear的步骤
After you have downloaded and installed PHP, you have to manually execute the batch file located in e.g. c:\php\go-pear.bat. The setup will ask you some questions and afterwards the PEAR Package Manager will be installed in the path, which you have specified during installation.
在下载并安装PHP后,你需要手动去执行php安装目录下的
go-pear.bat这个批处理文件进入pear的安装,安装过程中会问你一些问题。其实你只需要一路点ENTER键就是了。然后PEAR就被安装了。当然,如果你在安装过程中仔细应付每一个问题,pear的安装就会有所不同啦。。
Finally you have to add that installation path to your PATH environment. Either do this manually (Start > Control Panel > System > Environment) or run (double-click) the newly generated PEAR_ENV.reg that's now found in the PHP source directory.
最后你需要去添加pear路径到PATH环境变量中,可以手动即到开始-》控制面板-》系统-》环境变量,或者直接双击刚刚在安装时生成的文件
PEAR_ENV.reg,这个文件在php目录下。
After that you can access the PEAR Package Manager by running the command pear in a Windows Command Prompt.
然后嘛,你就可以访问PEAR,通过在cmd窗口提示下执行pear
To update your PEAR installation, request http://pear.php.net/go-pear in your browser and save the output to a local file go-pear.php. You can then run
升级的话,就在浏览器中打开上面那个网址,并保存go-pear.php文件。。然后执行如下的CMD命令
php go-pear.php
in a Windows Command Prompt to start the update process.
====================基本使用====================
1. 查看已安装了包,即安装的第4步,运行 pear list 命令。
2. 了解包的更多信息: 运行 pear info packet_name
3. 更多的 pear 命令可以通过键入 pear help [命令名] 获得。
4. 安装 pear 包: pear install packet_name
pear install -o packet_name (自动安装所需的依赖包)
pear install -a packet_name (自动安装可选和必需的依赖包)
5. 升级 pear 包: pear upgrade packet_name
6. 卸载 pear 包: pear uninstall packet_name
====================一个实例====================
1. 安装 Numbers_Roman 包: pear install Numbers_Roman
2. 编写程序:
<?php
/**
* Created on 2009-6-6
*
* 利用 pear 的 Numbers_Roman 包将阿拉伯数字转换成 罗马数字
*/
require_once("Numbers/Roman.php");
$year = date("Y");
$romanyear = Numbers_Roman::toNumeral($year);
echo "今年是 ".$romanyear." 年(罗马数字表示)";
?>
3. 运行脚本,结果输出——
今年是 MMIX 年(罗马数字表示)