sous-chefs/php

Answer prompted questions when installing pecl

Opened this issue · 2 comments

🗣️ Foreword

Hi, I'm having a problem to install a pecl because I can't answer the prompted questions.

:person_frowning: Problem Statement

When installing the pecl redis (https://pecl.php.net/package/redis) on the command line with pecl install redis, I get prompted some questions (in this case, to enable igbinary serializer support):

# pecl install redis
downloading redis-3.1.6.tgz ...
Starting to download redis-3.1.6.tgz (199,920 bytes)
..............done: 199,920 bytes
20 source files, building
running: phpize
Configuring for:
PHP Api Version:         20131106
Zend Module Api No:      20131226
Zend Extension Api No:   220131226
enable igbinary serializer support? [no] :

I need to somehow answer yes to this question.

❔ Possible Solution

Allow me to answer yes to the question. One option on the command line is yes | pecl install redis

⤴️ Describe alternatives you've considered

I didn't managed to get it working by playing with the available options.

➕ Additional context

At the moment I install it with php_pear like so:

php_pear "redis" do
  action :install
  version "5.2.2"
  channel 'pecl.php.net'
end

Is there a way of answering it on the CLI automatically?

Is there a way of answering it on the CLI automatically?

This was created a while ago so I can't test it right now. Some Stack Overflow replies led to the yes | solution mentioned above, but that's insufficient (users might not want to reply to all questions with yes). But this answer https://stackoverflow.com/a/72981599 makes me believe that if we could pass the parameter --configureoptions with desired values to pecl, then it would work, and users would only need to check which options are supported by the package they're installing (in my case, https://github.com/phpredis/phpredis/blob/develop/package.xml#L147).

Link to the PECL manual that describes these options: https://pear.php.net/manual/en/guide.developers.package2.pecl.php