PEAR modules

From Exterior Memory
Jump to: navigation, search

Install PEAR

On Mac OS X, PEAR is installed by default. It is also available as "pear-base" package for DarwinPorts, but that is broken for me.

On Debian, you should install with apt-get install php5-dev.

Upgrade

To show packages to upgrade, type:

pear list-upgrades

You can run pear upgrade-all or pear upgrade <packagename> to upgrade. To upgrade pear itself, run pear upgrade pear.

Add channels

pear channel-discover pear.phpdb.org

Install packages

pear install Archive_Tar

To install beta releases:

pear config-set preferred_state beta
pear install phpdb/propel_generator
pear config-set preferred_state stable

or simply

pear install phpdb/propel_generator-beta

Install PECL modules

Before installing a PECL modules, you often have to install the required library first. For example, to install the PECL modules for pdflib, you first need to install pdflib

port install pdflib

Then you can compile pdflib extension using pecl/pear:

sudo pecl install pdflib
path to pdflib installation? : /opt/local

The answer to the path question depends where you installed the libary. Pay close attention to the last lines of the pecl output. It will tell you were it has installed the new extension. For example in /usr/lib/php/extensions/no-debug-non-zts-20020429/pdf.so or /opt/local/lib/php/extensions/no-debug-non-zts-20050922/pdf.so

Finally, you need to add this new extension (.so, shared object) to your php.ini file.

extension_dir = "/opt/local/lib/php/extensions/"
extension=no-debug-non-zts-20050922/pdf.so

Currently installed packages

% pear list -a

Installed packages, channel pear.php.net:
=========================================
Package              Version State
Archive_Tar          1.3.1   stable
Console_Getopt       1.2     stable
DB                   1.7.6   stable
HTTP                 1.4.0   stable
HTTP_Session         0.5.2   beta
Image_Canvas         0.3.0   alpha
Image_Color          1.0.2   stable
Image_Graph          0.7.2   alpha
Log                  1.9.5   stable
Mail                 1.1.10  stable
Mail_Mime            1.3.1   stable
Net_SMTP             1.2.8   stable
Net_Socket           1.0.6   stable
Net_UserAgent_Detect 2.2.0   stable
Numbers_Roman        1.0.1   beta
Numbers_Words        0.15.0  beta
PEAR                 1.4.9   stable
XML_Parser           1.2.7   stable
XML_RPC              1.4.8   stable
pdflib               2.0.5   stable

Installed packages, channel pear.phpdb.org:
===========================================
Package          Version  State
creole           1.1.0RC1 beta
jargon           1.1.0RC1 beta
propel_generator 1.2.0RC1 beta
propel_runtime   1.2.0RC1 beta

Installed packages, channel pecl.php.net:
=========================================
(no packages installed)

Installed packages, channel __uri:
==================================
(no packages installed)

Installed packages, channel pear.phing.info:
============================================
Package Version  State
phing   2.2.0RC2 stable