forked from teddysun/lamp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathioncube.sh
More file actions
90 lines (82 loc) · 2.53 KB
/
Copy pathioncube.sh
File metadata and controls
90 lines (82 loc) · 2.53 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
#!/bin/bash
#=========================================================#
# System Required: CentOS / RedHat / Fedora #
# Description: ionCube for LAMP #
# Author: Teddysun <i@teddysun.com> #
# Visit: https://lamp.sh #
#=========================================================#
if [[ $EUID -ne 0 ]]; then
echo "Error:This script must be run as root!" 1>&2
exit 1
fi
cur_dir=`pwd`
# is 64bit or not
function is_64bit(){
if [ `getconf WORD_BIT` = '32' ] && [ `getconf LONG_BIT` = '64' ] ; then
return 0
else
return 1
fi
}
# get PHP version
INSTALLED_PHP=$(php -r 'echo PHP_VERSION;' 2>/dev/null | awk -F. '{print $1$2}')
if [ $? -ne 0 ] || [[ -z $INSTALLED_PHP ]]; then
echo "Error:PHP looks like not installed, please check it and try again."
exit 1
fi
# get PHP extensions date
if [ $INSTALLED_PHP -eq 53 ]; then
phpVer='5.3'
extDate='20090626'
elif [ $INSTALLED_PHP -eq 54 ]; then
phpVer='5.4'
extDate='20100525'
elif [ $INSTALLED_PHP -eq 55 ]; then
phpVer='5.5'
extDate='20121212'
elif [ $INSTALLED_PHP -eq 56 ]; then
phpVer='5.6'
extDate='20131226'
elif [ $INSTALLED_PHP -eq 70 ]; then
echo "ionCube Loader not support PHP 7.0 now."
exit 1
fi
if is_64bit; then
ionCubeVer='ioncube_loaders_lin_x86-64.tar.gz'
else
ionCubeVer='ioncube_loaders_lin_x86.tar.gz'
fi
# Install ionCube
echo "ionCube install start..."
if [ ! -d $cur_dir/untar/ ]; then
mkdir -p $cur_dir/untar/
fi
# Download ionCube
if [ -s ${ionCubeVer} ]; then
echo "${ionCubeVer} [found]"
else
echo "${ionCubeVer} not found!!!download now......"
if ! wget -c -t3 http://lamp.teddysun.com/files/${ionCubeVer}; then
echo "Failed to download ${ionCubeVer}, please download it to ${cur_dir} directory manually and retry."
exit 1
fi
fi
tar zxf ${ionCubeVer} -C $cur_dir/untar/
# Copy file
cp -pf $cur_dir/untar/ioncube/ioncube_loader_lin_$phpVer.so /usr/local/php/lib/php/extensions/no-debug-non-zts-$extDate/
# Create configuration file
if [ ! -f /usr/local/php/php.d/ioncube.ini ]; then
echo "ionCube configuration not found, create it!"
cat > /usr/local/php/php.d/ioncube.ini<<-EOF
[ionCube Loader]
zend_extension = /usr/local/php/lib/php/extensions/no-debug-non-zts-${extDate}/ioncube_loader_lin_${phpVer}.so
EOF
fi
# Clean up
cd $cur_dir
rm -rf $cur_dir/untar/
rm -f $cur_dir/${ionCubeVer}
# Restart httpd service
/etc/init.d/httpd restart
echo "ionCube install completed..."
exit