File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- ourname=fastlz
3
+ PHP_VERSION=$( /usr/bin/php-config --version)
4
+ PHP_VERSION_MAJOR=$( echo ${PHP_VERSION} | sed -r ' s/^([0-9]+)\..*$/\1/' )
5
+ PHP_VERSION_MINOR=$( echo ${PHP_VERSION} | sed -r ' s/^[0-9]+\.([0-9]+).*$/\1/' )
4
6
5
- if [ -d /etc/php5/conf.d ] ; then
7
+ ourname=fastlz
6
8
7
- # check whether we have the new-style layout (php 5.4)
9
+ # check whether we have the new-style layout (php 5.4)
10
+ if [ ${PHP_VERSION_MAJOR} -eq 5 ] && [ ${PHP_VERSION_MINOR} -ge 4 ]; then
11
+ [ ! -d /etc/php5/mods-available ] && { echo " Error: no /etc/php5/mods-available dir found" ; exit 1; }
8
12
9
- if [ -d /etc/php5/mods-available ]; then
10
-
11
13
# remove legacy file if found
12
14
[ -e " /etc/php5/conf.d/${ourname} .ini" ] && rm " /etc/php5/conf.d/${ourname} .ini"
13
15
14
16
# install new file only if not present already
15
- if [ -d /etc/php5/mods-available ] && [ ! -e " /etc/php5/mods-available/${ourname} .ini" ]; then
17
+ if [ ! -e " /etc/php5/mods-available/${ourname} .ini" ]; then
16
18
echo " extension=${ourname} .so" > " /etc/php5/mods-available/${ourname} .ini"
17
19
php5enmod " ${ourname} "
18
20
fi
19
-
20
- else
21
-
21
+ else
22
22
# old style, directly in conf.d
23
+ [ ! -d /etc/php5/conf.d ] && { echo " Error: no /etc/php5/conf.d dir found" ; exit 1; }
24
+
23
25
if [ ! -e " /etc/php5/conf.d/${ourname} .ini" ]; then
24
26
echo " extension=${ourname} .so" > " /etc/php5/conf.d/${ourname} .ini"
25
27
fi
26
-
27
- fi
28
-
29
28
fi
30
29
31
30
exit 0
31
+
You can’t perform that action at this time.
0 commit comments