PHPDocWiki : RFC/InstallPECL

PECL Install RFC

by Philip Olson


A modified version of is in the manual here: http://php.net/manual/en/install.pecl.php



Contents

General Considerations

PHP extensions may be installed in a variety of ways. PECL is a repository of PHP extensions living within the PEAR structure, and the following demonstrates how to install these extensions.

The source of these extensions may be found at http://pecl.php.net/ or retrieved from CVS using:

Where extname is the name of the extension, and the password for the cvsread user is phpfi.

When building PHP modules it's important to have the appropriate versions of the required tools (autoconf,automake,libtool,etc.) See http://www.php.net/anoncvs.php for details.

Windows users will find compiled PECL extension binaries here:

Further information for the extension can be found here:

Assumptions:

PEAR Shared

PEAR makes it easy to create shared (.so) PHP extensions. Using the pear command do the following:

That will download the source for extname, and compile it on the system. This results in a .so file that may then be included in php.ini

In case the preferred_state differs, like it's set to stable and the extension is still in beta, either set the preferred_state via “pear config-set” or simply specify a specific version of the extension. For example:

Either way pear will copy this .so into your extensions directory. Modify php.ini accordingly.

Manual Shared

If using pear is not an option then creating a shared extension may also be done as follows. The pear command essentially does this but it may also be done manually. Let's call the source file extname.tgz and assume it was downloaded into the current directory:

This creates a .so file (extname.so) and puts it in a modules/ and/or .libs/ directory within extname/. Move this into the PHP extensions directory, and then include it inside of php.ini

This is especially useful for building shared PECL extensions from CVS, as the PEAR installer is unaware of unreleased PECL packages.

PHP Static

To statically include the extension within the PHP build, put the extensions source within the ext/ directory found in the PHP source.
For example:

This will result in the following directory:

From here, build your PHP as normal:

Whether --enable-extname or --with-extname is used depends on the extension. Typically an
extension that does not require external libraries uses --enable. To be
sure, after running buildconf try: