在Windows下安装pear

Windows 下安装pear,修改go-pear.bat如下:

 

@ECHO OFF
set PHP_BIN=php.exe
%PHP_BIN% -d phar.require_hash=0 PEAR\go-pear.phar
pause

 

以下内容于2012-09-07更新

步骤:

  1. 到 http://windows.php.net/downloads/releases/archives/ 下载PHP,解压并重命名到为php5.x.x,进入php5.x.x目录
  2. 如果需要扩展,打开php.ini,设置 extension_dir = "ext" , 取消对应扩展的注释
  3. 打开cmd,进入php5.x.x目录,运行go-pear
  4. 提示
    Are you installing a system-wide PEAR or a local copy?
    (system|local) [system]

    按回车确定

  5. 提示
    1. Installation base ($prefix)                   : D:\path_to_your_php\php5.x.x2. Temporary directory for processing            : D:\path_to_your_php\php5.x.x\tmp
     3. Temporary directory for downloads             : D:\path_to_your_php\php5.x.x\tmp
     4. Binaries directory                            : D:\path_to_your_php\php5.x.x5. PHP code directory ($php_dir)                 : D:\path_to_your_php\php5.x.x\pear
     6. Documentation directory                       : D:\path_to_your_php\php5.x.x\docs
     7. Data directory                                : D:\path_to_your_php\php5.x.x\data
     8. User-modifiable configuration files directory : D:\path_to_your_php\php5.x.x\cfg
     9. Public Web Files directory                    : D:\path_to_your_php\php5.x.x\www
    10. Tests directory                               : D:\path_to_your_php\php5.x.x\tests
    11. Name of configuration file                    : D:\path_to_your_php\php5.x.x\pear.ini
    12. Path to CLI php.exe                           : D:\path_to_your_php\php5.x.x
    1-12, ‘all’ or Enter to continue:

    确定无误,则按回车,输入数字则修改对应项。修改后,按回车进行安装。

  6. 生成环境变量PEAR_ENV.reg文件,双击导入注册表
  7. 此时,输入pear -V 查看版本信息,输入pear list 查看已安装的包
  8. 如果pear list查看没有 Image_GraphViz 包和 Log 包,则使用 pear install Log 安装Log,使用 pear install Image_GraphViz
  9. 安装 Image_GraphViz 时,如果提示不能包含Structures/Graph/Node.php,则
    1. 尝试set查看PHP_PEAR_*相关环境变量是否正确
    2. 尝试关闭cmd窗口,再打开,再pear install Image_GraphViz
    3. 尝试pear install Stuctures_Graph,再pear install Image_GraphViz
  10. 至此,pear list 应有
    INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:
    =========================================
    PACKAGE          VERSION STATE
    Archive_Tar      1.3.3   stable
    Console_Getopt   1.2.3   stable
    Image_GraphViz   1.3.0   stable
    Log              1.12.7  stable
    PEAR             1.9.0   stable
    Structures_Graph 1.0.2   stable
    XML_Util         1.2.1   stable  

此时,使用 pear upgrade-all 即可升级所有的包。

 

你可能感兴趣的:(在Windows下安装pear)