-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathphp_extend.sh
154 lines (148 loc) · 6.46 KB
/
php_extend.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash
###### php扩展安装
###### 定义变量
server_install_log_path="/tmp/server_install.log"
date_show_str=`date '+%Y-%m-%d %H:%M:%S'`
phpize_path="/usr/local/php/bin/phpize"
php_config_path="/usr/local/php/bin/php-config"
php_ini_path="/usr/local/php/lib/php.ini"
igbinary_tar_gz="igbinary-2.0.1.tgz"
igbinary_dir="igbinary-2.0.1"
igbinary_name="igbinary"
redis_server_tar_gz="redis-3.0.7.tar.gz"
redis_server_dir="redis-3.0.7"
redis_server_name="redis"
redis_server_path="/usr/local/redis"
local_pwd=`pwd`
redis_tar_gz="redis-3.1.2.tgz"
redis_dir="redis-3.1.2"
redis_name="redis"
ImageMagick_tar_gz="ImageMagick.tar.gz"
ImageMagick_dir="ImageMagick-6.8.9-7"
ImageMagick_name="ImageMagick"
imagick_tar_gz="imagick-3.4.3.tgz"
imagick_dir="imagick-3.4.3"
imagick_name="imagick"
##### igbinary安装
if [ -e "${igbinary_tar_gz}" ]
then
echo "${date_show_str} ----- ${igbinary_tar_gz}源码文件存在 -----"
echo "${date_show_str} ----- ${igbinary_tar_gz}源码文件存在 -----" >> ${server_install_log_path}
echo "${date_show_str} ----- 解压${igbinary_tar_gz} -----"
echo "${date_show_str} ----- 解压${igbinary_tar_gz} -----" >> ${server_install_log_path}
tar zxvf ${igbinary_tar_gz}
cd ${igbinary_dir}
##### phpize
${phpize_path}
./configure --with-php-config=${php_config_path}
make && make install
echo -e "\nextension=igbinary.so" >> ${php_ini_path}
echo "${date_show_str} ----- 成功安装igbinary -----"
echo "${date_show_str} ----- 成功安装igbinary -----" >> ${server_install_log_path}
##### 返回上一目录
echo "${date_show_str} ----- 返回上一目录 -----"
echo "${date_show_str} ----- 返回上一目录 -----" >> ${server_install_log_path}
cd ../
else
echo "${date_show_str} ----- 请先上传${igbinary_tar_gz}源码 -----"
echo "${date_show_str} ----- 请先上传${igbinary_tar_gz} -----" >> ${server_install_log_path}
fi
##### redis_server安装
if [ -e "${redis_server_tar_gz}" ]
then
echo "${date_show_str} ----- ${redis_server_tar_gz}源码文件存在 -----"
echo "${date_show_str} ----- ${redis_server_tar_gz}源码文件存在 -----" >> ${server_install_log_path}
echo "${date_show_str} ----- 解压${redis_server_tar_gz} -----"
echo "${date_show_str} ----- 解压${redis_server_tar_gz} -----" >> ${server_install_log_path}
tar zxvf ${redis_server_tar_gz}
cp -rf ${redis_server_dir} ${redis_server_path}
cd ${redis_server_path}
make && make install
cp -rf redis.conf /etc/
##### 将redis添加到自启动中
echo "/usr/local/bin/redis-server /etc/redis.conf &" >> /etc/rc.d/rc.local
##### 启动redis 先不要启动,还要修改配置才可以启动
##### redis-server /etc/redis.conf
echo "${date_show_str} ----- 成功安装redis_server -----"
echo "${date_show_str} ----- 成功安装redis_server -----" >> ${server_install_log_path}
##### 返回上一目录
echo "${date_show_str} ----- 返回上一目录 -----"
echo "${date_show_str} ----- 返回上一目录 -----" >> ${server_install_log_path}
cd ${local_pwd}
else
echo "${date_show_str} ----- 请先上传${redis_server_tar_gz}源码 -----"
echo "${date_show_str} ----- 请先上传${redis_server_tar_gz} -----" >> ${server_install_log_path}
fi
##### redis安装
if [ -e "${redis_tar_gz}" ]
then
echo "${date_show_str} ----- ${redis_tar_gz}源码文件存在 -----"
echo "${date_show_str} ----- ${redis_tar_gz}源码文件存在 -----" >> ${server_install_log_path}
echo "${date_show_str} ----- 解压${redis_tar_gz} -----"
echo "${date_show_str} ----- 解压${redis_tar_gz} -----" >> ${server_install_log_path}
tar zxvf ${redis_tar_gz}
cd ${redis_dir}
##### phpize
${phpize_path}
./configure --enable-redis-igbinary --with-php-config=${php_config_path}
make && make install
echo -e "\nextension=redis.so" >> ${php_ini_path}
echo "${date_show_str} ----- 成功安装redis -----"
echo "${date_show_str} ----- 成功安装redis -----" >> ${server_install_log_path}
##### 返回上一目录
echo "${date_show_str} ----- 返回上一目录 -----"
echo "${date_show_str} ----- 返回上一目录 -----" >> ${server_install_log_path}
cd ../
else
echo "${date_show_str} ----- 请先上传${redis_tar_gz}源码 -----"
echo "${date_show_str} ----- 请先上传${redis_tar_gz} -----" >> ${server_install_log_path}
fi
##### ImageMagick服务安装
if [ -e "${ImageMagick_tar_gz}" ]
then
echo "${date_show_str} ----- ${ImageMagick_tar_gz}源码文件存在 -----"
echo "${date_show_str} ----- ${ImageMagick_tar_gz}源码文件存在 -----" >> ${server_install_log_path}
echo "${date_show_str} ----- 解压${ImageMagick_tar_gz} -----"
echo "${date_show_str} ----- 解压${ImageMagick_tar_gz} -----" >> ${server_install_log_path}
tar zxvf ${ImageMagick_tar_gz}
cd ${ImageMagick_dir}
./configure --prefix=/usr/local/${ImageMagick_name}
make && make install
echo "${date_show_str} ----- 成功安装ImageMagick服务 -----"
echo "${date_show_str} ----- 成功安装ImageMagick服务 -----" >> ${server_install_log_path}
##### 返回上一目录
echo "${date_show_str} ----- 返回上一目录 -----"
echo "${date_show_str} ----- 返回上一目录 -----" >> ${server_install_log_path}
cd ../
else
echo "${date_show_str} ----- 请先上传${ImageMagick_tar_gz}源码 -----"
echo "${date_show_str} ----- 请先上传${ImageMagick_tar_gz} -----" >> ${server_install_log_path}
fi
##### imagick安装
if [ -e "${imagick_tar_gz}" ]
then
echo "${date_show_str} ----- ${imagick_tar_gz}源码文件存在 -----"
echo "${date_show_str} ----- ${imagick_tar_gz}源码文件存在 -----" >> ${server_install_log_path}
echo "${date_show_str} ----- 解压${imagick_tar_gz} -----"
echo "${date_show_str} ----- 解压${imagick_tar_gz} -----" >> ${server_install_log_path}
tar zxvf ${imagick_tar_gz}
cd ${imagick_dir}
##### phpize
${phpize_path}
./configure --with-imagick=/usr/local/${ImageMagick_name}/ --with-php-config=${php_config_path}
make && make install
echo -e "\nextension=imagick.so" >> ${php_ini_path}
echo "${date_show_str} ----- 成功安装imagick -----"
echo "${date_show_str} ----- 成功安装imagick -----" >> ${server_install_log_path}
##### 返回上一目录
echo "${date_show_str} ----- 返回上一目录 -----"
echo "${date_show_str} ----- 返回上一目录 -----" >> ${server_install_log_path}
cd ../
else
echo "${date_show_str} ----- 请先上传${imagick_tar_gz}源码 -----"
echo "${date_show_str} ----- 请先上传${imagick_tar_gz} -----" >> ${server_install_log_path}
fi
##### kill掉进程
pkill -9 -f "php-fpm" && /etc/init.d/php-fpm
##### 重新启动
##### /etc/init.d/php-fpm