linux系统

linux下安装php的扩展包pear

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

蚊子今天给一台web服务器安装pear,安装过程还是挺简单的,pear官网提供了一个自动安装的方法

lynx –source http://pear.php.net/go-pear |/usr/local/php/bin/php

lynx如果没有,可以使用yum安装一下
管道后面是你的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 (http://user:password@proxy.myhost.com:port), 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的安装目录,蚊子我安装到了我的php安装目录下,这个可以根据个人情况调整

经过不长不短的下载安装后,如果没有啥报错的话,就算是正常装上了pear

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

# /usr/local/php/bin/pear list
Installed packages, channel pear.php.net:
=========================================
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支持的命令

http://pear.php.net/packages.php上可以看到pear提供的包,安装包的方法也很简单

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

Related Post

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.