「pecl、pear、peardev命令介绍」

  CREATED BY JENKINSBOT

这篇文章介绍的内容涉及了pecl、pear、peardev命令。因为这三个命令的man手册是相同的,所以将他们放在了同一篇文章中进行介绍。

pecl,主机命令工具,用于下载和开发PECL扩展。

pear,用于安装PEAR扩展。

peardev,是pear命令的包装,移除了正常配置的内存限制。

这篇文章介绍的PEAR的版本为version1.10.1

命令行语法格式

pear [ options ] command [command-options] <parameters>

pecl [ options ] command [command-options] <parameters>

peardev [ options ] command [command-options] <parameters>

相关的配置文件

/etc/pear.conf
系统级别的全局配置文件。

$HOME/.pearrc
用户个人的配置文件。

命令支持的选项及含义(命令中的options的取值)

-v increase verbosity level (default 1)

-q be quiet, decrease verbosity level

-c file find user configuration in file

-C file find system configuration in file

-d foo=bar set user config variable foo to bar

-D foo=bar set system config variable foo to bar

-G start in graphical (Gtk) mode

-S store system configuration

-s store user configuration

-y foo unset foo in the user configuration

-V / -h, -?
显示版本和帮助信息。

帮助命令

pear help options
查看所有的选项

pear help shortcuts
查看所有command的简写。

pear help command
用于查看某个command的帮助信息。

支持的command列表(命令中的command部分及每个command支持的command-options)

build

Build an Extension From C Source

bundle

Unpacks a Pecl Package

channel-add

Add a Channel

channel-alias

Specify an alias to a channel name

channel-delete

Remove a Channel From the List

channel-discover

Initialize a Channel from its server

channel-info

Retrieve Information on a Channel

channel-login

Connects and authenticates to remote channel server

channel-logout

Logs out from the remote channel server

channel-update

Update an Existing Channel

clear-cache

Clear Web Services Cache

config-create

Create a Default configuration file

config-get

Show One Setting

config-help

Show Information About Setting

config-set

Change Setting

config-show

Show All Settings

convert

Convert a package.xml 1.0 to package.xml 2.0 format

cvsdiff

Run a “cvs diff” for all files in a package

cvstag

Set CVS Release Tag

「download」: pecl download [options] <package>…

下载指定的package。下载文件以Server建议的格式命名,比如:下载DB包的最后一个稳定版本1.6.5,那下载后包名为DB-1.6.5.tgz。

支持的选项:

-Z, –nocompress
下载一个未压缩的包,.tar文件。

示例:

#!/bin/bash

# 下载pdo_sqlsrv
pecl download pdo_sqlsrv

download-all

Downloads each available package from the default channel

info

Display information about a package

「install」: pecl install [options] [channel/]<package> …

安装一个或者多个扩展包。可以使用以下四种方式来指定一个包:

  1. Package-1.0.tgz” : 安装本地的包。
  2. http://example.com/Package-1.0.tgz” : 安装网络中个一个包。
  3. package.xml” : 安装package.xml中描述的包。在测试中非常有用,或者将PEAR包包装在其他的如RPM之类的包管理器中。
  4. Package[-version/state][.tar]” : 查询默认的channel服务器(pear.php.net) ,下载质量/状态(stable)最好的最新包。

如果要下载1.1版本的Package,使用”Package-1.1“;如果要下载beta版本的包,使用”Package-beta“。如果要下载未压缩的文件,在结尾追加 .tar (先确保目录中没有同名文件)

如果要从其他的channel下载Package,给Package加上channel前缀,如:”channel/Package

如果一次要安装多个包,四种方式可以混合使用。

Options可以是以下选项:
-f, –force
will overwrite newer installed packages

-l, –loose
do not check for recommended dependency version

-n, –nodeps
ignore dependencies, install anyway

-r, –register-only
do not install files, only register the package as installed

-s, –soft
soft install, fail silently, or upgrade if already installed

-B, –nobuild
don’t build C extensions

-Z, –nocompress
request uncompressed files when downloading

-R DIR, –installroot=DIR
root directory used when installing files (ala PHP’s INSTALL_ROOT), use packagingroot for RPM

-P DIR, –packagingroot=DIR
root directory used when packaging files, like RPM packaging

–ignore-errors
force install even if there were errors

-a, –alldeps
install all required and optional dependencies

-o, –onlyreqdeps
install all required dependencies

-O, –offline
do not attempt to download any urls or contact channels

-p, –pretend
Only list the packages that would be downloaded

「list」:pecl list [options] <package>

List Installed Packages In The Default Channel

If invoked without parameters, this command lists the PEAR packages
installed in your php_dir (/usr/local/php-5.6.31/lib/php). With a parameter, it
lists the files in a package.

Options:
-c CHAN, –channel=CHAN

list installed packages from this channel

-a, –allchannels

list installed packages from all channels

-i, –channelinfo

output fully channel-aware data, even on failure

list-all

List All Packages

list-channels

List Available Channels

list-files

List Files In Installed Package

list-upgrades

List Available Upgrades

login

Connects and authenticates to remote server [Deprecated in favor of channel-login]

logout

Logs out from the remote server [Deprecated in favor of channel-logout]

make-rpm-spec

Builds an RPM spec file from a PEAR package

makerpm

Builds an RPM spec file from a PEAR package

package

Build Package

package-dependencies

Show package dependencies

package-validate

Validate Package Consistency

pickle

Build PECL Package

remote-info

Information About Remote Packages

remote-list

List Remote Packages

run-scripts

Run Post-Install Scripts bundled with a package

run-tests

Run Regression Tests

search

在远程的数据库中搜索某个包。

shell-test

Shell Script Test

sign

Sign a package distribution file

svntag

Set SVN Release Tag

uninstall

Un-install Package

update-channels

Update the Channel List

upgrade

Upgrade Package

upgrade-all

Upgrade All Packages [Deprecated in favor of calling upgrade with no parameters]

参考文献

PEAR Manual
PEAR Bugs