php 在没有提示的情况下安装 PECL 模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8141407/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Install PECL modules without the prompts
提问by Obinwanne Hill
I just installed PHP on Ubuntu Natty from source.
我刚刚从源代码在 Ubuntu Natty 上安装了 PHP。
I'm trying to use PECL to install additional modules like APC and Memcache. I'm using something like this:
我正在尝试使用 PECL 安装其他模块,如 APC 和 Memcache。我正在使用这样的东西:
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).
如何使用 pecl 命令只接受默认值?我在留言板上看到了这样的东西:printf "yes\n" | pecl install pecl_http
。但是,在 APC 的情况下,对于默认值为 no(我认为)的情况,这将回答 yes。
Thanks in advance.
提前致谢。
采纳答案by Obinwanne Hill
The following code seems to work ok:
以下代码似乎工作正常:
printf "\n" | pecl install apc
You can also replace apc with any other PECL package.
您还可以用任何其他 PECL 包替换 apc。
Cheers.
干杯。
回答by Tom Boutell
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
回答by Ian Bytchek
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.
Obinwanne 的 Hill 回答为我指明了方向,所以我在这里没有提供任何新内容,但以下内容似乎是绝对最短的,也没有任何花哨的工具。
echo '' | pecl install apc