PEAR是PHP的官方开源类库, PHP Extension and Application Repository的缩写。Pear在英文中是梨子的意思。PEAR将PHP程序开发过程中常用的功能编写成类库,涵盖了页面呈面、数据库访问、文件操作、数据结构、缓存操作、网络协议等许多方面,用户可以很方便地使用。


lynx –source |/usr/local/php/bin/php


Welcome to go-pear!

Go-pear will install the ‘pear’ command and all the files needed by
it.  This command is your tool for PEAR installation and maintenance.

Go-pear also lets you download and install the following optional PEAR
packages: PEAR_Frontend_Web-beta, PEAR_Frontend_Gtk2, MDB2.

If you wish to abort, press Control-C now, or press Enter to continue:

HTTP proxy (, or Enter for none::

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 prefix ($prefix) : .
2. Temporary files directory     : $prefix/temp
3. Binaries directory            : $prefix/bin
4. PHP code directory ($php_dir) : $prefix/lib/php
5. Documentation base directory  : $php_dir/docs
6. Data base directory           : $php_dir/data
7. Tests base directory          : $php_dir/tests

1-7, ‘all’ or Enter to continue: all

之后就会出现上面的内容,如果你的服务器可以直接上网,那HTTP proxy那块直接回车就行了


通过使用pear list可以查看当前系统已经安装了哪些包

# /usr/local/php/bin/pear list
Installed packages, channel
Package          Version State
Archive_Tar      1.3.7   stable
Config           1.10.11 stable
Console_Getopt   1.2.3   stable
MDB2             2.4.1   stable
MIME_Type        1.2.1   stable
Net_POP3         1.3.8   stable
Net_Socket       1.0.10  stable
PEAR             1.9.1   stable
Structures_Graph 1.0.3   stable
XML_Util         1.2.1   stable

使用pear help可以看到pear支持的命令上可以看到pear提供的包,安装包的方法也很简单

使用 pear install 包名就可以把相应的包装上了。

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *