Install PECL modules without the prompts

PhpPecl

Php Problem Overview


I just installed PHP on Ubuntu Natty from source.

I'm trying to use PECL to install additional modules like APC and Memcache. I'm using something like this:

pecl install apc

However, I get prompts asking me to confirm things.

How can I use the pecl command to just accept the defaults? I saw something like this on a message board: printf "yes\n" | pecl install pecl_http. However, in the case of APC this would answer yes for things where the default is no (I think).

Thanks in advance.

Php Solutions


Solution 1 - Php

The following code seems to work ok:

printf "\n" | pecl install apc

You can also replace apc with any other PECL package.

Cheers.

Solution 2 - Php

The "yes" command can do more than just type "yes"; it can type anything you want, over and over. Including an empty line, which is a good way to accept defaults.

I just needed this myself, so here is what worked well for me:

yes '' | pecl install -f apc

Solution 3 - Php

Obinwanne's Hill answer nailed it for me, so I'm not providing anything new here, but the following seems like the absolute shortest also without any fancy tools.

echo '' | pecl install apc

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionObiHillView Question on Stackoverflow
Solution 1 - PhpObiHillView Answer on Stackoverflow
Solution 2 - PhpTom BoutellView Answer on Stackoverflow
Solution 3 - PhpIan BytchekView Answer on Stackoverflow