pear command not found

In this troubleshooting guide we learn how to fix pear command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

pear: command not found

or when using sudo you get the following error message

sudo: pear: command not found

Solutions to pear: command not found

How To Fix pear: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu pear is provided by php-pear package.

php-pear is:

The PEAR package contains:

  • the PEAR installer, for creating, distributing and installing packages
  • the PEAR_Exception PHP5 error handling mechanism
  • the PEAR_ErrorStack advanced error handling mechanism
  • the PEAR_Error error handling mechanism
  • the OS_Guess class for retrieving info about the OS where PHP is running on
  • the System class for quick handling of common operations with files and directories
  • the PEAR base class Features in a nutshell:
  • full support for channels
  • pre-download dependency validation
  • new package.xml 2.0 format allows tremendous flexibility while maintaining BC
  • support for optional dependency groups and limited support for sub-packaging
  • robust dependency support
  • full dependency validation on uninstall
  • remote install for hosts with only ftp access - no more problems with restricted host installation
  • full support for mirroring
  • support for bundling several packages into a single tarball
  • support for static dependencies on a url-based package
  • support for custom file roles and installation tasks

To fix this problem, we can install more using the command below.

sudo apt-get -y install php-pear

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install php-pear.

sudo apt -y install php-pear

Or if you have aptitude installed you can use the following command.

sudo aptitude install php-pear

Summary

In this tutorial we learn how to fix pear command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.