linux安装php扩展脚本分享
程序员文章站
2023-01-08 17:58:52
测试环境:ubuntu 12.04 php 5.3.x
复制代码 代码如下:#!/bin/bash#program:# accomplish to expand...
测试环境:ubuntu 12.04 php 5.3.x
复制代码 代码如下:
#!/bin/bash
#program:
# accomplish to expand the specified function only one key
#history:
# 2013/11/15 pankai<530911044@qq.com> first release
test ! -f ./ext_skel && echo "the shell script of 'ext_skel' doesn't exist in current directory.\n" && exit 0
[ ! -d "skeleton" ] && echo "the directory of 'skeleton' doesn't exist in current directory.\n" && exit 0
#include "./ext_skel"
read -p "please input the extension name: " ext_name
#echo -e "hello $ext_name"
#the blank space is necessary
#error:
# like: if[ ! -d "$ext_name" ]; then
if [ ! -d "$ext_name" ]; then
./ext_skel --extname=$ext_name
fi
file="./$ext_name/config.m4"
copy="./$ext_name/config"
if [ ! -f "./$ext_name/configs" ]; then
# create a new file and clear it if it exists
:> "$copy"
cat "$file" | while read line
#for line in $( cat ./zend/config.m4 )
do
string=$( echo $line | grep 'php_arg_enable' )
if [ "$string" != "" ]; then
echo $line | cut -c5- >> $copy
read line
echo $line | cut -c5- >> $copy
read line
echo $line | cut -c5- >> $copy
read line
fi
echo $line >> $copy
done
mv "$file" "./$ext_name/configs"
mv "$copy" "./$ext_name/config.m4"
fi
cd $ext_name
phpize
./configure