Skip to content

Commit 63ca69c

Browse files
committed
Add mongo to PHP 5.6
1 parent 4fa0355 commit 63ca69c

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

scripts/install-php.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
1+
. /etc/os-release
12
[ "${BUILDS:?}" = "debug" ] && PHP_PKG_SUFFIX=-dbgsym
23
cp /var/lib/dpkg/status /var/lib/dpkg/status-orig
34
DEBIAN_FRONTEND=noninteractive apt-get install -f
5+
6+
enable_pecl_extension() {
7+
local extension=$1
8+
sudo curl -o /etc/php/"$PHP_VERSION"/mods-available/"$extension".ini -sL https://raw.githubusercontent.com/shivammathur/php-builder/main/config/modules/"$extension".ini
9+
phpenmod -v "$PHP_VERSION" "$extension"
10+
}
11+
412
echo "Installing PHP $PHP_VERSION"
513

614
DEBIAN_FRONTEND=noninteractive apt-fast install -y --no-install-recommends \
@@ -141,11 +149,19 @@ for extension in sqlsrv pdo_sqlsrv; do
141149
sudo pecl install -f "$extension"
142150
fi
143151
if [[ $PHP_VERSION =~ 7.[0-4]|8.[0-2] ]]; then
144-
sudo curl -o /etc/php/"$PHP_VERSION"/mods-available/"$extension".ini -sL https://raw.githubusercontent.com/shivammathur/php-builder/main/config/modules/"$extension".ini
145-
phpenmod -v "$PHP_VERSION" "$extension"
152+
enable_pecl_extension "$extension"
146153
fi
147154
done
148155

156+
if [ "$PHP_VERSION" = "5.6" ]; then
157+
if [[ "$VERSION_ID" = "18.04" || "$VERSION_ID" = "20.04" ]]; then
158+
DEBIAN_FRONTEND=noninteractive apt-fast install -y --no-install-recommends php$PHP_VERSION-mongo
159+
else
160+
sudo pecl install -f mongo
161+
enable_pecl_extension mongo
162+
fi
163+
fi
164+
149165
sudo rm -rf /var/cache/apt/archives/*.deb || true
150166
sudo rm -rf /var/cache/apt/archives/*.ddeb || true
151167

0 commit comments

Comments
 (0)