php - 在没有用户提示的情况下安装 PHP Pear

标签 php automation pear

是否有命令行参数允许您在没有用户提示的情况下安装 PHP Pear?我想自动执行以下操作:

wget http://pear.php.net/go-pear.phar
php go-pear.phar
pear config-set preferred_state beta
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear install --alldeps phpunit/PHPUnit
rm go-pear.phar

php go-pear.phar 提示用户输入安装/配置信息。

最佳答案

结果 expect成功了。这是我最终得到的结果:

安装-pear.sh

#!/usr/bin/expect
spawn wget -O /tmp/go-pear.phar http://pear.php.net/go-pear.phar
expect eof

spawn php /tmp/go-pear.phar

expect "1-11, 'all' or Enter to continue:"
send "\r"
expect eof

spawn rm /tmp/go-pear.phar

安装-phpunit.sh

#!/bin/bash
./install-pear.sh
pear config-set preferred_state beta
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear install --alldeps phpunit/PHPUnit

运行:

sudo apt-get install expect
chmod 744 ./install-pear.sh
chmod 744 ./install-phpunit.sh
sudo ./install-phpunit.sh

关于php - 在没有用户提示的情况下安装 PHP Pear,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7164584/

相关文章:

php - CakePhp : Cake bake doesn't work on Ubuntu.(PDO异常)

php 资源 ID #11 问题

powershell - 使用 PowerShell 以编程方式配置 Internet Explorer 代理设置,使其在打开之前起作用

php - 选取所有fieldone不等于null的字段 + Propel

PHP 连接 MySQL 错误

testing - com.microsoft.sqlserver.jdbc.SQLServerException : The driver could not establish a secure connection to SQL Server by using SSL encryption

powershell - 如何使用 Azure 自动化运行存储过程?

php - 使用 PEAR 的 Mail_Queue 时遇到问题

php - 山狮 php pear 和 pecl

PHP根据数组元素值对来自两个数组的值进行计算