mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Check version of installed php
Signed-off-by: Rob Gill <rrobgill@protonmail.com>
This commit is contained in:
parent
8776348a80
commit
9422d57283
1 changed files with 20 additions and 6 deletions
|
@ -160,14 +160,28 @@ if command -v apt-get &> /dev/null; then
|
|||
# use iproute
|
||||
iproute_pkg="iproute"
|
||||
fi
|
||||
# We prefer the php metapackage if it's there
|
||||
# Check for and determine version number, major and minor of current php install
|
||||
if command -v php &> /dev/null; then
|
||||
phpInsVersion="$(php -v | head -n1 | grep -Po '(?<PHP )[^ ]+')"
|
||||
echo -e " ${INFO} Existing PHP installation detected : PHP version $phpInsVersion"
|
||||
fi
|
||||
# Check if installed php is supported version (5.4 is EOL)
|
||||
if [[ $phpInsVersion < "5.5" ]]; then
|
||||
# Prefer the php metapackage if it's there
|
||||
if ${PKG_MANAGER} install --dry-run php > /dev/null 2>&1; then
|
||||
phpVer="php"
|
||||
# If not,
|
||||
else
|
||||
# fall back on the php5 packages
|
||||
else
|
||||
phpVer="php5"
|
||||
fi
|
||||
else
|
||||
# Supported php is installed, its common, cgi & sqlite counterparts are deps
|
||||
phpInsMajor="$(echo $phpInsVer | cut -d\. -f1)"
|
||||
phpInsMinor="$(echo $phpInsVer | cut -d\. -f2)"
|
||||
phpVer="php$phpInsMajor.phpInsMinor"
|
||||
fi
|
||||
|
||||
fi
|
||||
# We also need the correct version for `php-sqlite` (which differs across distros)
|
||||
if ${PKG_MANAGER} install --dry-run ${phpVer}-sqlite3 > /dev/null 2>&1; then
|
||||
phpSqlite="sqlite3"
|
||||
|
|
Loading…
Reference in a new issue