32

I'm trying to run the following command in terminal on my macbook pro

cd /tmp; pecl download memcached

but im getting

pecl:command not found.

after a days googling I cant find out whats up. Does anyone have a solution?

jdee
  • 11,612
  • 10
  • 38
  • 36
  • This page https://stackoverflow.com/questions/32893056/installing-pecl-and-pear-on-os-x-10-11-el-capitan-macos-10-12-sierra-macos-10 gives good answer to install `pear` on Mac – Shark Deng Aug 05 '19 at 10:50

5 Answers5

60
apt-get update

apt-get install php-pear php5-dev
Shahzad Barkati
  • 2,532
  • 6
  • 25
  • 33
Chadams
  • 1,833
  • 1
  • 18
  • 15
19

At least on Arch Linux you must install php-pear package for the pecl tool by using this command:

pacman -S php-pear
bisko
  • 3,948
  • 1
  • 27
  • 29
  • 6
    What do you mean by at least Arch Linux? The question is clearly tagged with OSX. Please edit or remove your answer as this is not answering the question for future references – Peyman Mohamadpour Dec 31 '16 at 14:23
  • 2
    After several hours of search I found this answer and it works for me out of my surprise. P.S. You can use yum if pacman doesn't works – Nilesh Feb 15 '19 at 12:50
  • this answer is not relevent to the question – Preston Reyes Jan 16 '20 at 21:27
6

Old thread but might be useful for someone... On OSX with MAMP installed its best to find out which version of php installed (from the /Applications/MAMP/bin/php/* directory).

Then either temporarily

export PATH=/Applications/MAMP/bin/php/php5.5.3/bin:$PATH

or permanently

echo "export PATH=/Applications/MAMP/bin/php/php5.5.3/bin:$PATH" >> ~/.profile

then

which pecl

then tells you, e.g.

/Applications/MAMP/bin/php/php5.5.3/bin/pecl
KevinY
  • 1,229
  • 1
  • 12
  • 27
5

The reason you are getting this error is because Pear package is missing.

I encountered the same problem while installing the PHP extension for MongoDB on Ubuntu. What worked for me was the following:

Install Pear Package:

sudo apt install php-dev php-pear

then you can run:

sudo pecl install memcached
Hyder B.
  • 10,900
  • 5
  • 51
  • 60
  • Note for those using Linux 2 EC2 on AWS, use `yum` instead of `apt` example: `sudo yum install php-dev php-pear` – mcphersonjr Mar 14 '23 at 22:22
5

I know, old post but for anyone else.

On Windows PECL and PEAR commands are not found but they are pre-installed in PHP.

They are not in the windows path so you have to cd into the PEAR directory to run the command or add the PEAR directory to your systems path variable

There is a .bat file in the PEAR directory which is supposed to do this for you if you double click it but it did not work for me on win7 so I manually add the path or just cd to the directory to run it

fred
  • 59
  • 1
  • 1