Using channels


Channels are alternative package sources. See the channel section of the manual for more information.

What you need to know now: By using channels, you can install packages that are not part of PEAR. Prominent PHP projects like Horde and PHPUnit distribute their software through PEAR-compatible channels.

Channel discovery

Before you can use a channel, your pear installation needs to know about it. This process is called "channel discovery".

Once you know the project's channel url, just type:

$ pear channel-discover
Adding Channel "" succeeded

Downloading a channel.xml file, you can add a channel just using that file using channel-add:

$ pear channel-add my-channel.xml

Using list-channels, you can get an overview of known channels:

$ pear list-channels
Registered Channels:
Channel                  Summary         eZ Enterprise components
demochanserv.bogo        Simple demo channel server                PHP-Gtk2 applications   Chiara Testing Channel          Channel for Phing build tool releases             PHP Extension and Application Repository          PHPUnit channel server symfony project PEAR channel            PEAR-Compatible Extension and Application
                         Repository             PHP Extension Community Library
__uri                    Pseudo-channel for static packages

More insight about a channel can be gotten with channel-info. It prints out a description, the channel's shortcut name (alias) as well as mirror information.

$ pear channel-info
Channel Information:
Name and Server
Alias                   pear
Summary                 PHP Extension and Application Repository

Work with packages on a channel

When installing or doing anything else with a package that is not in your default channel, you need to specify the channel by full name or alias:

$ pear install gnope/Dev_Inspector
... installation of package "Dev_Inspector" in channel "gnope"

$ pear list -c
Installed packages, channel
Package Version State
PHPUnit 3.2.5   stable

General rule is that when you would specify a package name, use $channel/$packagename now. All other functions with channel support have a -c option to specify the channel name or alias.

Password protected channels

PEAR compatible channels can be password protected. You could use this to e.g. distribute custom proprietary software to your clients, and don't want to publicy publish those packages anywhere.

Password protection is done via a HTTP Basic Authentication (.htaccess and .htpassword on Apache). When trying to discover such a password protected channel, you will get a message like this:

$ pear channel-discover
Discovery of channel "" failed
 (channel-add: Cannot open ""
 (File not valid
 (received: HTTP/1.1 401 Authorization Required

In this case, download the channel.xml file manually, for example with your browser or wget. A channel.xml is always in the root directory of the channel server. After that, discover the channel with the saved file:

$ pear channel-add /path/to/saved/channel.xml
Adding Channel "" succeeded

Now the PEAR manager needs to know about the channel's username and password. We tell him by using set-config in connection with the channel option:

$ pear config-set -c username johndoe
config-set succeeded
$ pear config-set -c password secret
config-set succeeded

Now test if we did everything right by showing available packages on the channel:

$ pear list-all -c
Retrieving data...0%
All packages [Channel]:
Package             Latest Local
comp/WorldDominator 0.8.1        Tool to dominate the world

If you changed your creditentials, you should issue a pear clear-cache command to make sure that the installer does not use cached data.

Getting information about packages (Previous) Command list (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.