Skip to content

Instantly share code, notes, and snippets.

@blanklin030
Last active December 5, 2018 07:46
Show Gist options
  • Save blanklin030/80eea60fd34ca1e99caaef28b417b6fb to your computer and use it in GitHub Desktop.
Save blanklin030/80eea60fd34ca1e99caaef28b417b6fb to your computer and use it in GitHub Desktop.
自动安装php7的yar、yaf、redis扩展
echo "========install extension begin==========="
PHP_PATH='/usr/local/php'
PHP_CONFIG_PATH=$PHP_PATH"/php-config"
PHP_INI_PATH=$PHP_PATH"/php.ini"
PHPIZE_PATH=$PHP_PATH"/phpize"
PHP_EXTENSION_PATH=$PHP_PATH"/lib/php/extensions/no-debug-non-zts-20151012"
echo "========install yar==========="
wget http://pecl.php.net/get/yar-2.0.4.tgz
tar zxvf yar-2.0.4.tgz
cd yar-2.0.4
$PHPIZE_PATH
./configure --with-php-config=$PHP_CONFIG_PATH
make && make install
if [ ! -f $PHP_EXTENSION_PATH"/yar.so" ]; then
echo "yar.so文件没生成,自动退出"
exit 1
fi
echo "extension=yar.so" >> $PHP_INI_PATH
sleep 3
echo "========install yaf==========="
wget http://pecl.php.net/get/yaf-3.0.7.tgz
tar zxvf yaf-3.0.7.tgz
cd yaf-3.0.7
$PHPIZE_PATH
./configure --with-php-config=$PHP_CONFIG_PATH
make && make install
if [ ! -f $PHP_EXTENSION_PATH"/yaf.so" ]; then
echo "yaf.so文件没生成,自动退出"
exit 1
fi
echo "extension=yaf.so" >> $PHP_INI_PATH
sleep 3
echo "========install redis==========="
wget http://pecl.php.net/get/redis-4.1.1.tgz
tar zxvf redis-4.1.1.tgz
cd redis-4.1.1
$PHPIZE_PATH
./configure --with-php-config=$PHP_CONFIG_PATH
make && make install
if [ ! -f $PHP_EXTENSION_PATH"/redis.so" ]; then
echo "redis.so文件没生成,自动退出"
exit 1
fi
echo "extension=redis.so" >> $PHP_INI_PATH
echo "========install extension end==========="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment