Skip to content

Commit

Permalink
Merge pull request #387 from Automattic/fix-php84-alpine
Browse files Browse the repository at this point in the history
fix(php,xdebug): PHP 8.4 is now in Alpine 3.21
  • Loading branch information
sjinks authored Dec 9, 2024
2 parents c7bdd34 + 9184db7 commit 08fa57e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion features/src/php/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "php",
"name": "PHP",
"description": "Installs PHP into the Dev Environment",
"version": "2.7.0",
"version": "2.7.1",
"documentationURL": "https://github.com/Automattic/vip-codespaces/tree/trunk/features/src/php",
"options": {
"version": {
Expand Down
12 changes: 10 additions & 2 deletions features/src/php/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,13 @@ setup_php83_alpine() {
}

setup_php84_alpine() {
alpine_version="$(cat /etc/alpine-release)"
if [ "$(printf '%s\n' "3.21" "${alpine_version}" | sort -V | head -n1 || true)" = "3.21" ]; then
REPOS=""
else
REPOS="-X https://dl-cdn.alpinelinux.org/alpine/v3.21/community"
fi

if [ "${LITE_INSTALL}" != 'true' ]; then
# missing: php84-pecl-mcrypt php84-pecl-timezonedb
EXTENSIONS="icu-data-full ghostscript php84-bcmath php84-ftp php84-intl php84-soap php84-pecl-igbinary php84-pecl-ssh2"
Expand Down Expand Up @@ -268,10 +275,11 @@ setup_php84_alpine() {
php84-xml \
php84-xmlreader \
php84-xmlwriter \
php84-zip ${EXTENSIONS} -X https://dl-cdn.alpinelinux.org/alpine/edge/testing
php84-zip ${EXTENSIONS} ${REPOS}

if [ "${SKIP_GMAGICK}" != 'true' ]; then
apk add --no-cache php84-dev gcc make libc-dev graphicsmagick-dev libtool graphicsmagick libgomp -X https://dl-cdn.alpinelinux.org/alpine/edge/testing
# shellcheck disable=SC2086
apk add --no-cache php84-dev gcc make libc-dev graphicsmagick-dev libtool graphicsmagick libgomp ${REPOS}
pecl84 channel-update pecl.php.net
pecl84 install channel://pecl.php.net/gmagick-2.0.6RC1 < /dev/null || true
echo "extension=gmagick.so" > /etc/php84/conf.d/40_gmagick.ini
Expand Down
2 changes: 1 addition & 1 deletion features/src/xdebug/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Xdebug",
"id": "xdebug",
"version": "1.5.0",
"version": "1.5.1",
"description": "Configures Xdebug for the Dev Environment",
"options": {
"enabled": {
Expand Down
10 changes: 9 additions & 1 deletion features/src/xdebug/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ xdebug_83_alpine() {
}

xdebug_84_alpine() {
apk add --no-cache php84-pecl-xdebug -X https://dl-cdn.alpinelinux.org/alpine/edge/testing
alpine_version="$(cat /etc/alpine-release)"
if [ "$(printf '%s\n' "3.21" "${alpine_version}" | sort -V | head -n1 || true)" = "3.21" ]; then
REPOS=""
else
REPOS="-X https://dl-cdn.alpinelinux.org/alpine/v3.21/community"
fi

# shellcheck disable=SC2086 # We need to expand $REPOS
apk add --no-cache php84-pecl-xdebug ${REPOS}
rm -f /etc/php81/conf.d/50_xdebug.ini
}

Expand Down

0 comments on commit 08fa57e

Please sign in to comment.