-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_php_53_54_55_56.sh
More file actions
429 lines (380 loc) · 10.8 KB
/
install_php_53_54_55_56.sh
File metadata and controls
429 lines (380 loc) · 10.8 KB
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
#/bin/bash
################################
## INSTALAÇÃO PHP-MultiVersão ##
## Data: 03/10/2016 ##
## Atualização 01/03/2016 ##
## Autor: Amauri Hideki ##
################################
base(){
#Pacote base
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-2.5.8-9.el6.x86_64.rpm
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/libmcrypt-devel-2.5.8-9.el6.x86_64.rpm
rpm -ivh libmcrypt-2.5.8-9.el6.x86_64.rpm
rpm -ivh libmcrypt-devel-2.5.8-9.el6.x86_64.rpm
yum install mysql-devel.x86_64 postgresql-devel.x86_64 libxml2-devel.x86_64 bzip2-devel.x86_64 libcurl-devel.x86_64 libjpeg-turbo-devel.x86_64 libpng-devel.x86_64 libXpm.x86_64 libXpm-devel.x86_64 freetype.x86_64 freetype-devel.x86_64 libc-client-devel.x86_64 libtool-ltdl-devel.x86_64 pcre-devel.x86_64 mysql.x86_64 mysql-devel.x86_64 mysql-connector-odbc.x86_64 mysql-connector-java.noarch mysql-libs.x86_64 wget.x86_64 openssl-devel.x86_64 pam-devel.x86_64 mariadb-devel.x86_64 -y
yum groupinstall 'Development Tools'
#wget http://dl.fedoraproject.org/pub/epel/7/x86_64/l/libmcrypt-2.5.8-13.el7.x86_64.rpm
#rpm -ivh libmcrypt-2.5.8-13.el7.x86_64.rpm
#wget http://dl.fedoraproject.org/pub/epel/7/x86_64/l/libmcrypt-devel-2.5.8-13.el7.x86_64.rpm
#rpm -ivh libmcrypt-devel-2.5.8-13.el7.x86_64.rpm
#wget http://dl.fedoraproject.org/pub/epel/7/x86_64/l/libtidy-0.99.0-31.20091203.el7.x86_64.rpm
#rpm -ivh libtidy-0.99.0-31.20091203.el7.x86_64.rpm
#wget http://dl.fedoraproject.org/pub/epel/7/x86_64/l/libtidy-devel-0.99.0-31.20091203.el7.x86_64.rpm
#rpm -ivh libtidy-devel-0.99.0-31.20091203.el7.x86_64.rpm
mkdir -p /opt/source/php-src
mkdir -p /data/www/sites-enabled
mkdir -p /data/www/cgi-bin
}
instalacao_php_versoes(){
php_53(){
#php53
cd /opt/source/php-src
wget http://de.php.net/get/php-5.3.29.tar.bz2/from/this/mirror -O php-5.3.29.tar.bz2
tar jxf php-5.3.29.tar.bz2
cd php-5.3.29
mkdir /opt/php-5.3
./configure \
--prefix=/opt/php-5.3 \
--with-pdo-pgsql \
--with-zlib-dir \
--with-freetype-dir \
--enable-mbstring \
--with-libxml-dir=/usr \
--with-xpm-dir=/usr \
--enable-soap \
--enable-calendar \
--with-curl \
--with-mcrypt \
--with-zlib \
--with-gd \
--with-pgsql \
--disable-rpath \
--enable-inline-optimization \
--with-bz2 \
--with-zlib \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-pcntl \
--enable-mbregex \
--with-mhash \
--enable-zip \
--with-pcre-regex \
--with-mysql=/usr/ \
--with-pdo-mysql \
--with-mysql-sock=/tmp/mysql.sock \
--with-mysqli=mysqlnd \
--with-pgsql=/usr \
--with-tidy=/usr \
--with-pdo-pgsql=/usr \
--with-pdo-mysql=mysqlnd \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--with-openssl \
--with-libdir=lib64 \
--enable-ftp \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--with-gettext \
--with-gd \
--with-jpeg-dir=/usr/lib/ \
--enable-cgi
make
make install
mkdir /opt/php-5.3/cgi
cp -a sapi/cgi/php-cgi /opt/php-5.3/cgi/php-cgi
echo '#!/bin/bash
PHP_CGI=/opt/php-5.3/cgi/php-cgi
PHP_FCGI_CHILDREN=4
PHP_FCGI_MAX_REQUESTS=1000
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec $PHP_CGI' > /var/www/cgi-bin/php-5.3.fcgi
echo 'NameVirtualHost *:80
<VirtualHost *:80>
ServerName site.com.br
ServerAlias www.site.com.br
DocumentRoot /var/www/html
ErrorLog /var/www/html/logs
Options Indexes FollowSymlinks Includes ExecCGI
ScriptAlias /local-bin /opt/php-5.3/bin
AddHandler application/x-httpd-php5 php
Action application/x-httpd-php5 /local-bin/php-cgi
<Directory "/opt/php-5.3/bin">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>' > /etc/httpd/conf.d/sitesPHP53.conf
}
php_54(){
#php54
cd /opt/source/php-src
wget http://de.php.net/get/php-5.4.45.tar.bz2/from/this/mirror -O php-5.4.45.tar.bz2
tar jxf php-5.4.45.tar.bz2
cd php-5.4.45
mkdir /opt/php-5.4
./configure \
--prefix=/opt/php-5.4 \
--with-pdo-pgsql \
--with-zlib-dir \
--with-freetype-dir \
--enable-mbstring \
--with-libxml-dir=/usr \
-–with-xpm-dir=/usr \
--enable-soap \
--enable-calendar \
--with-curl \
--with-mcrypt \
--with-zlib \
--with-gd \
--with-pgsql \
--disable-rpath \
--enable-inline-optimization \
--with-bz2 \
--with-zlib \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-pcntl \
--enable-mbregex \
--with-mhash \
--enable-zip \
--with-pcre-regex \
--with-mysql \
--with-pdo-mysql \
--with-mysqli \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--with-openssl \
--with-fpm-user=apache \
--with-fpm-group=apache \
--with-libdir=lib64 \
--enable-ftp \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--with-gettext \
--with-gd \
--with-jpeg-dir=/usr/lib/ \
--enable-fpm
make
make install
mkdir /opt/php-5.4/cgi
cp -a sapi/cgi/php-cgi /opt/php-5.4/cgi/php-cgi
echo '#!/bin/bash
PHP_CGI=/opt/php-5.4/cgi/php-cgi
PHP_FCGI_CHILDREN=4
PHP_FCGI_MAX_REQUESTS=1000
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec $PHP_CGI' > /var/www/cgi-bin/php-5.4.fcgi
echo 'NameVirtualHost *:80
<VirtualHost *:80>
ServerName site.com.br
ServerAlias www.site.com.br
DocumentRoot /var/www/html
ErrorLog /var/www/html/logs
Options Indexes FollowSymlinks Includes ExecCGI
ScriptAlias /local-bin /php-5.4/bin
AddHandler application/x-httpd-php5 php
Action application/x-httpd-php5 /local-bin/php-cgi
<Directory "/opt/php-5.4/bin">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>' > /etc/httpd/conf.d/sitesPHP54.conf
}
php_55(){
#php55
cd /opt/source/php-src
wget http://de.php.net/get/php-5.5.37.tar.bz2/from/this/mirror -O php-5.5.37.tar.bz2
tar jxf php-5.5.37.tar.bz2
cd php-5.5.37
mkdir /opt/php-5.5
./configure \
--prefix=/opt/php-5.5 \
--with-pdo-pgsql \
--with-zlib-dir \
--with-freetype-dir \
--enable-mbstring \
--with-libxml-dir=/usr \
-–with-xpm-dir=/usr \
--enable-soap \
--enable-calendar \
--with-curl \
--with-mcrypt \
--with-zlib \
--with-gd \
--with-pgsql \
--disable-rpath \
--enable-inline-optimization \
--with-bz2 \
--with-zlib \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-pcntl \
--enable-mbregex \
--with-mhash \
--enable-zip \
--with-pcre-regex \
--with-mysql \
--with-pdo-mysql \
--with-mysqli \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--with-openssl \
--with-fpm-user=apache \
--with-fpm-group=apache \
--with-libdir=lib64 \
--enable-ftp \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--with-gettext \
--with-gd \
--with-jpeg-dir=/usr/lib/ \
--enable-fpm
make
make install
mkdir /opt/php-5.5/cgi
cp -a sapi/cgi/php-cgi /opt/php-5.5/cgi/php-cgi
echo '#!/bin/bash
PHP_CGI=/opt/php-5.5/cgi/php-cgi
PHP_FCGI_CHILDREN=4
PHP_FCGI_MAX_REQUESTS=1000
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec $PHP_CGI' > /var/www/cgi-bin/php-5.5.fcgi
echo 'NameVirtualHost *:80
<VirtualHost *:80>
ServerName site.com.br
ServerAlias www.site.com.br
DocumentRoot /var/www/html
ErrorLog /var/www/html/logs
Options Indexes FollowSymlinks Includes ExecCGI
ScriptAlias /local-bin /opt/php-5.5/bin
AddHandler application/x-httpd-php5 php
Action application/x-httpd-php5 /local-bin/php-cgi
<Directory "/opt/php-5.5/bin">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
' > /etc/httpd/conf.d/sitesPHP55.conf
}
php_56(){
#php56
cd /opt/source/php-src
wget http://de.php.net/get/php-5.6.25.tar.bz2/from/this/mirror -O php-5.6.25.tar.bz2
tar jxf php-5.6.25.tar.bz2
cd php-5.6.25
mkdir /opt/php-5.6
./configure \
--prefix=/opt/php-5.6 \
--with-pdo-pgsql \
--with-zlib-dir \
--with-freetype-dir \
--enable-mbstring \
--with-libxml-dir=/usr \
-–with-xpm-dir=/usr \
--enable-soap \
--enable-calendar \
--with-curl \
--with-mcrypt \
--with-zlib \
--with-gd \
--with-pgsql \
--disable-rpath \
--enable-inline-optimization \
--with-bz2 \
--with-zlib \
--enable-sockets \
--enable-sysvsem \
--enable-sysvshm \
--enable-pcntl \
--enable-mbregex \
--with-mhash \
--enable-zip \
--with-pcre-regex \
--with-mysql \
--with-pdo-mysql \
--with-mysqli \
--with-png-dir=/usr \
--enable-gd-native-ttf \
--with-openssl \
--with-fpm-user=apache \
--with-fpm-group=apache \
--with-libdir=lib64 \
--enable-ftp \
--with-imap \
--with-imap-ssl \
--with-kerberos \
--with-gettext \
--with-gd \
--with-jpeg-dir=/usr/lib/ \
--enable-fpm
make
make install
mkdir /opt/php-5.6/cgi
cp -a sapi/cgi/php-cgi /opt/php-5.6/cgi/php-cgi
echo '#!/bin/bash
PHP_CGI=/opt/php-5.6/cgi/php-cgi
PHP_FCGI_CHILDREN=4
PHP_FCGI_MAX_REQUESTS=1000
export PHP_FCGI_CHILDREN
export PHP_FCGI_MAX_REQUESTS
exec $PHP_CGI' > /var/www/cgi-bin/php-5.6.fcgi
#adicionar Include /var/www/sites-enabled/*.conf > /etc/httpd/conf/httpd.conf
echo 'NameVirtualHost *:80
<VirtualHost *:80>
ServerName site.com.br
ServerAlias www.site.com.br
DocumentRoot /var/www/html
ErrorLog /var/www/html/logs
Options Indexes FollowSymlinks Includes ExecCGI
ScriptAlias /local-bin /opt/php-5.6/bin
AddHandler application/x-httpd-php5 php
Action application/x-httpd-php5 /local-bin/php-cgi
<Directory "/opt/php-5.6/bin">
Order allow,deny
Allow from all
</Directory>
</VirtualHost>' > /etc/httpd/conf.d/sitePHP56.conf
}
php_teste(){
echo teste
}
# MENU
options=("php_53" "php_54" "php_55" "php_56" "php_teste")
menu() {
echo -e "\\033[1;39m \\033[1;32mOPÇÕES DISPONÍVEIS:\\033[1;39m \\033[1;0m"
for i in ${!options[@]}; do
printf "%3d%s) %s\n" $((i+1)) "${choices[i]:- }" "${options[i]}"
done
[[ "$msg" ]] && echo "$msg"; :
}
prompt="SELECIONE A OPÇÃO DISPONÍVEL (novamente para remover checkbox, ENTER para concluir): "
while menu && read -rp "$prompt" num && [[ "$num" ]]; do
[[ "$num" != *[![:digit:]]* ]] &&
(( num > 0 && num <= ${#options[@]} )) ||
{ msg="OPÇÃO INVÁLIDA: $num"; continue; }
((num--)); msg="${options[num]} was ${choices[num]:+un}checked"
[[ "${choices[num]}" ]] && choices[num]="" || choices[num]="+"
done
echo -e "\\033[1;39m \\033[1;32mITENS SELECIONADOS\\033[1;39m \\033[1;0m"; msg=" nothing"
for i in ${!options[@]}; do
[[ "${choices[i]}" ]] && { echo "${options[i]}"; msg=""; } && echo "5 segundos para iniciar a instalação" && sleep 5 && { "${options[i]}"; msg=""; }
done
}
conclusao(){
chmod 755 /var/www/cgi-bin/*
echo "Adicionar 'Include /etc/httpd/conf.d/*.conf > /etc/httpd/conf/httpd.conf'"
echo "Atenção - Versão de PHP é definido dentro de cada vhost dos domínios"
echo ""
ls /opt/ | grep php-5 | while read phpv; do /opt/$phpv/bin/php -version && echo ''; done
}
base
instalacao_php_versoes
conclusao