zoukankan      html  css  js  c++  java
  • 在linux上安装pear

    在搭建centreon的过程中,需要pear模块支持。

    什么是pear

    pear是PHP扩展与应用库(the PHP Extension and Application Repository)的缩写。它是一个PHP扩展及应用的一个代码仓库,简单地说,pear就是PHP的cpan。

    在官网上有说明详细的安装信息,这里作简单说明。

    http://pear.php.net/manual/en/about-pear.php

    我的PHP目录为/usr/local/php5

    在Linux下安装PHP的PEAR:
    1)下载
    #curl -o go-pear.php  http://pear.php.net/go-pear

    如果提示:

    PHP Warning:  PHP Startup: Invalid library (maybe not a PHP library) ‘json.so’  in Unknown on line 0
    Sorry!  Your PHP version is too new (5.2.9) for this go-pear.
    Instead use http://pear.php.net/go-pear.phar for a more stable and current
    version of go-pear, more suited to your PHP version.

    那么要从http://pear.php.net/go-pear.phar获取。

    #curl -o go-pear.php http://pear.php.net/go-pear.phar

    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
    Dload  Upload   Total   Spent    Left  Speed
    100 3594k  100 3594k    0     0   186k      0  0:00:19  0:00:19 –:–:–  196k

    会在当前目录下载go-pear.php 页面。
    2)运行go-pear.php  直接执行PHP go-pear.php
    # /usr/local/php5/bin/php go-pear.php

    3)这里按回车继续安装,CTRL+C放弃安装。

    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)                   : /usr/local/php5
    2. Temporary directory for processing            : /tmp/pear/install
    3. Temporary directory for downloads             : /tmp/pear/install
    4. Binaries directory                            : /usr/local/php5/bin
    5. PHP code directory ($php_dir)                 : /usr/local/php5/lib/php
    6. Documentation directory                       : /usr/local/php5/docs
    7. Data directory                                : /usr/local/php5/data
    8. User-modifiable configuration files directory : /usr/local/php5/cfg
    9. Public Web Files directory                    : /usr/local/php5/www
    10. Tests directory                               : /usr/local/php5/tests
    11. Name of configuration file                    : /usr/local/php5/etc/pear.conf

    1-11, ‘all’ or Enter to continue:
    Beginning install…
    Configuration written to /usr/local/php5/etc/pear.conf…
    Initialized registry…
    Preparing to install…
    installing phar://go-pear.phar/PEAR/go-pear-tarballs/Archive_Tar-1.3.7.tar…
    installing phar://go-pear.phar/PEAR/go-pear-tarballs/Console_Getopt-1.3.0.tar…
    installing phar://go-pear.phar/PEAR/go-pear-tarballs/PEAR-1.9.4.tar…
    installing phar://go-pear.phar/PEAR/go-pear-tarballs/Structures_Graph-1.0.4.tar…
    installing phar://go-pear.phar/PEAR/go-pear-tarballs/XML_Util-1.2.1.tar…
    install ok: channel://pear.php.net/Archive_Tar-1.3.7
    install ok: channel://pear.php.net/Console_Getopt-1.3.0
    install ok: channel://pear.php.net/Structures_Graph-1.0.4
    install ok: channel://pear.php.net/XML_Util-1.2.1
    install ok: channel://pear.php.net/PEAR-1.9.4
    PEAR: Optional feature webinstaller available (PEAR’s web-based installer)
    PEAR: Optional feature gtkinstaller available (PEAR’s PHP-GTK-based installer)
    PEAR: Optional feature gtk2installer available (PEAR’s PHP-GTK2-based installer)
    PEAR: To install optional features use “pear install pear/PEAR#featurename”

    ** WARNING! Old version found at /usr/local/php5/bin, please remove it or be sure to use the new /usr/local/php5/bin/pear command

    The ‘pear’ command is now at your service at /usr/local/php5/bin/pear

    ** The ‘pear’ command is not currently in your PATH, so you need to
    ** use ‘/usr/local/php5/bin/pear’ until you have added
    ** ‘/usr/local/php5/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/

    安装完毕

    下面通过pear来安装PHP_PEAR_DB库

    http://pear.php.net/package/DB/download  


    先下载了,然后安装:

    # /usr/local/php5/bin/pear install DB-1.7.14.tgz 
    Package "pear.php.net/DB" dependency "pear.php.net/PEAR" has no releases
    install ok: channel://pear.php.net/DB-1.7.14

    # find  / -name "DB.php"
    /usr/local/php5/lib/php/DB.php

     

    原文地址 http://blog.chinaunix.net/uid-25266990-id-3393387.html

  • 相关阅读:
    大话设计模式笔记 装饰模式
    大话设计模式笔记 依赖倒转原则
    大话设计模式笔记 单一职责原则 开放-封闭原则
    Effective Java 英文 第二版 读书笔记 Item 5:Avoid creating unnecessary objects.
    Effective Java 英文 第二版 读书笔记 Item 4:Attempting to enforce noninstantiability by making a class abstract does not work.
    Effective Java 英文 第二版 读书笔记 Item 3:Enforce the singleton property with a private constructor or an enum type.
    Effective Java 英文 第二版 读书笔记 Item 2:Consider a builder when faced with many constructor parameters.
    大话设计模式笔记 策略模式
    大话设计模式笔记 简单工厂模式
    jvm的垃圾回收算法
  • 原文地址:https://www.cnblogs.com/lxwphp/p/15454497.html
Copyright © 2011-2022 走看看