在没有提示的情况下安装 PECL 模块

发布于 2024-12-15 13:45:00 字数 292 浏览 5 评论 0原文

我刚刚在 Ubuntu Natty 上从源代码安装了 PHP。

我正在尝试使用 PECL 安装其他模块,例如 APC 和 Memcache。我正在使用这样的东西:

pecl install apc

但是,我收到提示要求我确认事情。

如何使用 pecl 命令只接受默认值?我在留言板上看到类似这样的内容: printf "yes\n" | pecl 安装 pecl_http。然而,在 APC 的情况下,对于默认为“否”的情况,这将回答“是”(我认为)。

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).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

信仰 2024-12-22 13:45:00

以下代码似乎可以正常工作:

printf "\n" | pecl install apc

您还可以将 apc 替换为任何其他 PECL 包。

干杯。

The following code seems to work ok:

printf "\n" | pecl install apc

You can also replace apc with any other PECL package.

Cheers.

帅的被狗咬 2024-12-22 13:45:00

“yes”命令的作用不仅仅是键入“yes”;它可以一遍又一遍地输入您想要的任何内容。包括一个空行,这是接受默认值的好方法。

我自己只需要这个,所以这对我来说很有效:

yes '' | pecl install -f apc

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
梦里梦着梦中梦 2024-12-22 13:45:00

如果您不想对每个提示给出相同的答案(“是”、“否”或“”),您可以使用 --configureoptions 为每个选项设置特定值(请参阅PECL 手册)。

您需要找到包的 package.xml 文件以查看哪些选项是可配置的。例如,对于 memcached 包,您可以转到此处:

https://github.com/php-memcached-dev/php-memcached/blob/master/package.xml

搜索 标记,在本例中为:

<configureoption name="with-libmemcached-dir"     prompt="libmemcached directory"     default="no"/>
<configureoption name="with-zlib-dir"             prompt="zlib directory"             default="no"/>
<configureoption name="with-system-fastlz"        prompt="use system fastlz"          default="no"/>
<configureoption name="enable-memcached-igbinary" prompt="enable igbinary serializer" default="no"/>
<configureoption name="enable-memcached-msgpack"  prompt="enable msgpack serializer"  default="no"/>
<configureoption name="enable-memcached-json"     prompt="enable json serializer"     default="no"/>
<configureoption name="enable-memcached-protocol" prompt="enable server protocol"     default="no"/>
<configureoption name="enable-memcached-sasl"     prompt="enable sasl"                default="yes"/>
<configureoption name="enable-memcached-session"  prompt="enable sessions"            default="yes"/>

然后您可以将这些选项传递给安装命令,如下所示:

pecl install --configureoptions 'with-libmemcached-dir="no" with-zlib-dir="no" with-system-fastlz="no" enable-memcached-igbinary="yes" enable-memcached-msgpack="no" enable-memcached-json="no" enable-memcached-protocol="no" enable-memcached-sasl="yes" enable-memcached-session="yes"' memcached

If you don't want give the same answer for every single prompt ("yes", "no", or ""), you can use --configureoptions to set specific values for each option (see the PECL manual).

You'll want to find your package's package.xml file to see what options are configurable. As an example, for the memcached package, you'd go here:

https://github.com/php-memcached-dev/php-memcached/blob/master/package.xml

Search for the <configureoption> tags, which in this case are:

<configureoption name="with-libmemcached-dir"     prompt="libmemcached directory"     default="no"/>
<configureoption name="with-zlib-dir"             prompt="zlib directory"             default="no"/>
<configureoption name="with-system-fastlz"        prompt="use system fastlz"          default="no"/>
<configureoption name="enable-memcached-igbinary" prompt="enable igbinary serializer" default="no"/>
<configureoption name="enable-memcached-msgpack"  prompt="enable msgpack serializer"  default="no"/>
<configureoption name="enable-memcached-json"     prompt="enable json serializer"     default="no"/>
<configureoption name="enable-memcached-protocol" prompt="enable server protocol"     default="no"/>
<configureoption name="enable-memcached-sasl"     prompt="enable sasl"                default="yes"/>
<configureoption name="enable-memcached-session"  prompt="enable sessions"            default="yes"/>

You can then pass these options along to the install command like so:

pecl install --configureoptions 'with-libmemcached-dir="no" with-zlib-dir="no" with-system-fastlz="no" enable-memcached-igbinary="yes" enable-memcached-msgpack="no" enable-memcached-json="no" enable-memcached-protocol="no" enable-memcached-sasl="yes" enable-memcached-session="yes"' memcached
温折酒 2024-12-22 13:45:00

Obinwanne 的 Hill 答案为我提供了答案,所以我不会在这里提供任何新内容,但以下内容似乎是绝对最短的,也没有任何花哨的工具。

echo '' | pecl install apc

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文