pecl
Install PHP extensions
TLDR
Display a list of available commands
Install a package
List installed packages
Upgrade all packages
Upgrade a specific package
Uninstall a specific package
Display information about a specific package
Update the available package sources
SYNOPSIS
pecl [global-options] command [command-options] [args]
PARAMETERS
-h, --help
Show help summary
-v, --verbose
Increase verbosity level (multiple for more)
-V, --version
Display version info
-C
PECL config directory
-d, --nodefaultsources
Ignore default channel sources
--force
Force operations (install/uninstall)
--alldeps
Install all dependencies
--nobuild
Skip building extension
--compile
Force compilation
--channel
Specify PECL channel
install
Install package(s)
uninstall
Uninstall package(s)
list
List installed or available packages
search
Search for packages
info
Show package details
update-channels
Update channel lists
channel-discover
Discover new channel
DESCRIPTION
pecl is the command-line tool for managing PHP extensions from the PHP Extension Community Library (PECL). It enables users to search, download, build, install, upgrade, and uninstall C-based PHP extensions that extend core PHP functionality, such as imagick, mongodb, or xdebug. Unlike pear for pure-PHP packages, pecl compiles extensions against PHP's Zend engine, requiring development headers and tools like phpize and php-config.
Key workflows include adding PECL channels, listing available or installed packages, and handling dependencies automatically. It supports multiple PHP versions and SAPI modes. Configuration is stored in /etc/php.d or user-specific dirs, with pecl.ini for preferences like preferred_state (stable/beta).
Originally part of the PEAR ecosystem, pecl remains essential for extensions not bundled with PHP, though modern alternatives like Composer handle pure-PHP deps. It's widely used on Linux servers for performance-critical extensions.
CAVEATS
Requires PHP development package (php-dev/php-devel); compilation needs gcc/make; root/sudo often required for system PHP; some extensions conflict with bundled PHP modules; deprecated in favor of Composer/pecl.php.net web UI for new installs.
CONFIGURATION
Uses ~/.peclconfig or /etc/pear.conf; set preferred_state=stable to avoid betas.
COMMON WORKFLOW
pecl channel-update pecl.php.net
pecl search mongodb
pecl install mongodb
Restart PHP-FPM/Apache after install.
HISTORY
Introduced in 2001 with PEAR 1.0 as PHP's first package manager; PECL separated for binary extensions around PHP 4.3 (2003). Matured with PHP 5.x, peaked in usage mid-2000s. PEAR2/PECL restructured 2010-2015; now legacy but maintained for extensions.


