A client asked me to install this last night and I figured i’d share the joy that is pear.
To install pear on a server, simply use the following commands;
wget http://pear.php.net/go-pear
php go-pear
Once pear is installed, you can see a list of the available options by typing in
pear
at the command line. This will bring up a list of switched, flags and commands to review, install and remove pear packages.
root@host [~]# pear
Commands:
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 Download Package
download-all Downloads each available package from the default channel
info Display information about a package
install Install Package
list List Installed Packages In The Default Channel
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]
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 Search remote package database
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]
Usage: pear [options] command [command-options]
Type "pear help shortcuts" to list all command shortcuts.
Type "pear help
To install mail_queue I searched for the package type I wanted to install;
root@host [~]# pear search mail_queue
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
Retrieving data...0%
....50%..Matched packages, channel pear.php.net:
=======================================
Package Stable/(Latest) Local
Mail 1.2.0b2 (beta) Class that provides multiple interfaces for sending emails
Mail_IMAP 1.1.0RC2 (beta) Provides a c-client backend for webmail.
Mail_IMAPv2 0.2.0 (beta) Provides a c-client backend for webmail.
Mail_Mbox 0.6.3 (beta) Read and modify Unix MBOXes
Mail_Mime 1.6.0RC2 (beta) Mail_Mime provides classes to create mime messages.
Mail_mimeDecode 1.5.1 (stable) Provides a class to decode mime messages.
Mail_Queue 1.2.3 (stable) Class for put mails in queue and send them later in background.
Net_Vpopmaild 0.3.2 (beta) Class for accessing Vpopmail's vpopmaild daemon
I see the package I want is Mail_Queue 1.2.3 (stable)
To install it I simply add the package to install
root@host [~]# pear install mail_queue
WARNING: channel "pear.php.net" has updated its protocols, use "pear channel-update pear.php.net" to update
Unknown remote channel: pear.phpdb.org
WARNING: "pear/DB" is deprecated in favor of "pear/MDB2"
Unknown remote channel: pear.phpdb.org
WARNING: "pear/MDB" is deprecated in favor of "pear/MDB2"
Did not download optional dependencies: channel://pear.phpdb.org/creole, pear/DB, channel://pear.phpdb.org/jargon, pear/MDB, pear/MDB2, use --alldeps to download automatically
Did not download dependencies: pear/Net_SMTP, use --alldeps or --onlyreqdeps to download automatically
pear/Mail_Queue can optionally use package "channel://pear.phpdb.org/creole"
pear/Mail_Queue can optionally use package "pear/DB"
pear/Mail_Queue can optionally use package "channel://pear.phpdb.org/jargon"
pear/Mail_Queue can optionally use package "pear/MDB"
pear/Mail_Queue can optionally use package "pear/MDB2"
pear/Mail can optionally use package "pear/Net_SMTP" (version >= 1.1.0)
downloading Mail_Queue-1.2.3.tgz ...
Starting to download Mail_Queue-1.2.3.tgz (19,482 bytes)
.......done: 19,482 bytes
Download of "pear/mail_queue" succeeded,
downloadingMail_Queue-1.2.3.tgz ...
Starting to download Mail_Queue-1.2.3.tgz (19,482 bytes)
...done: 19,482 bytes
install ok: channel://pear.php.net/Mail_Queue-1.2.3
To uninstall, simply reverse the process
root@host [~]# pear uninstall mail_queue
uninstall ok: channel://pear.php.net/Mail_Queue-1.2.3
root@host [~]#
That’s it!