How to Install PEAR Package Manager on Ubuntu

In this tutorial, you will learn how to install the PEAR package manager on Ubuntu Server and use PEAR packages in your applications.

PEAR is a repository of PHP packages that extend the functionality of PHP. Verify that you have the PEAR package manager installed on your system by typing the following command at the command line:

pear version

You should see the PEAR version, or you don't have the PEAR manager installed on your Ubuntu system.

pear version

To install PEAR on Ubuntu, execute the following command at the command line:

apt install php php-pear

Now we can use the pear command to download and install PEAR packages.

pear install package_name

For example, to install the Mail package, run the pear command as follows:

pear install Mail

You can use installed packages from your PHP application with an include() or require() statement.

<?php
include_once('Mail.php')
?>

To see all the PEAR packages currently installed on a system, you can use the list command:

pear list

Use the search command to search the PEAR package database:

pear search mail

You can run the pear help to list all command options.

Install PEAR Package Manager on Ubuntu

At https://pear.php.net/packages.php, you can find a list of all available packages for PEAR.