Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/features-global.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,9 @@ jobs:
fail-fast: false
matrix:
test:
- php81-alpine-base
- php82-alpine-base
- php83-alpine-base
- php84-alpine-base
- php81-ubuntu-base
- php82-ubuntu-base
- php83-ubuntu-base
- php84-ubuntu-base
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/features-scenarios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ jobs:
- feature: mariadb
- feature: nginx
- feature: photon
- feature: php
filter: '81'
- feature: php
filter: '82'
- feature: php
Expand Down
4 changes: 2 additions & 2 deletions features/src/php/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
"id": "php",
"name": "PHP",
"description": "Installs PHP into the Dev Environment",
"version": "2.10.2",
"version": "3.0.0",
"documentationURL": "https://github.com/Automattic/vip-codespaces/tree/trunk/features/src/php",
"options": {
"version": {
"type": "string",
"enum": ["8.0", "8.1", "8.2", "8.3", "8.4"],
"enum": ["8.2", "8.3", "8.4"],
"default": "8.3",
"description": "PHP version"
},
Expand Down
129 changes: 4 additions & 125 deletions features/src/php/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,73 +17,6 @@ PHP_VERSION="${VERSION}"
: "${LITE_INSTALL:=}"
: "${SKIP_GMAGICK:=}"

setup_php81_alpine() {
if [ "${LITE_INSTALL}" != 'true' ]; then
EXTENSIONS="icu-data-full ghostscript php81-bcmath php81-pecl-mcrypt php81-soap php81-pecl-igbinary php81-pecl-ssh2 php81-pecl-timezonedb"
else
EXTENSIONS=
fi

# shellcheck disable=SC2086 # We need to expand $REPOS
apk add --no-cache \
php81 php81-fpm php81-pear \
php81-pecl-apcu \
php81-calendar \
php81-ctype \
php81-curl \
php81-dom \
php81-exif \
php81-fileinfo \
php81-ftp \
php81-gd \
php81-gmp \
php81-iconv \
php81-json \
php81-mbstring \
php81-pecl-memcache \
php81-pecl-memcached \
php81-mysqli \
php81-mysqlnd \
php81-opcache \
php81-openssl \
php81-pcntl \
php81-pdo \
php81-pdo_mysql \
php81-pdo_sqlite \
php81-phar \
php81-posix \
php81-session \
php81-shmop \
php81-simplexml \
php81-sockets \
php81-sodium \
php81-sqlite3 \
php81-sysvsem \
php81-sysvshm \
php81-tokenizer \
php81-xml \
php81-xmlreader \
php81-xmlwriter \
php81-zip ${EXTENSIONS} -X https://dl-cdn.alpinelinux.org/alpine/v3.19/main -X https://dl-cdn.alpinelinux.org/alpine/v3.19/community

if [ "${SKIP_GMAGICK}" != 'true' ]; then
apk add --no-cache php81-dev gcc make libc-dev graphicsmagick-dev libtool graphicsmagick libgomp -X https://dl-cdn.alpinelinux.org/alpine/v3.19/main -X https://dl-cdn.alpinelinux.org/alpine/v3.19/community
pecl81 channel-update pecl.php.net || true
pecl81 install channel://pecl.php.net/gmagick-2.0.6RC1 < /dev/null || true
apk del --no-cache php81-dev gcc make libc-dev graphicsmagick-dev libtool
echo "extension=gmagick.so" > /etc/php81/conf.d/40_gmagick.ini
fi

[ ! -f /usr/bin/pear ] && ln -s /usr/bin/pear81 /usr/bin/pear
[ ! -f /usr/bin/peardev ] && ln -s /usr/bin/peardev81 /usr/bin/peardev
[ ! -f /usr/bin/pecl ] && ln -s /usr/bin/pecl81 /usr/bin/pecl
[ ! -f /usr/bin/phar.phar ] && ln -s /usr/bin/phar.phar81 /usr/bin/phar.phar
[ ! -f /usr/bin/phar ] && ln -s /usr/bin/phar81 /usr/bin/phar
[ ! -f /usr/bin/php ] && ln -s /usr/bin/php81 /usr/bin/php
[ ! -f /usr/sbin/php-fpm ] && ln -s /usr/sbin/php-fpm81 /usr/sbin/php-fpm
true
}

setup_php82_alpine() {
if [ "${LITE_INSTALL}" != 'true' ]; then
EXTENSIONS="icu-data-full ghostscript php82-bcmath php82-intl php82-pecl-mcrypt php82-soap php82-pecl-igbinary php82-pecl-ssh2 php82-pecl-timezonedb"
Expand Down Expand Up @@ -291,50 +224,6 @@ setup_php84_alpine() {
true
}

setup_php81_deb() {
if [ "${LITE_INSTALL}" != 'true' ]; then
EXTENSIONS="ghostscript php8.1-bcmath php8.1-igbinary php8.1-intl php8.1-mcrypt php8.1-soap php8.1-ssh2"
else
EXTENSIONS=
fi

if [ "${SKIP_GMAGICK}" != 'true' ]; then
EXTENSIONS="${EXTENSIONS} php8.1-gmagick"
fi

# shellcheck disable=SC2086
eatmydata apt-get install -y --no-install-recommends \
anacron \
php8.1-cli php8.1-fpm \
php8.1-apcu php8.1-curl php8.1-gd php8.1-gmp php8.1-mbstring \
php8.1-memcache php8.1-memcached php8.1-mysql php8.1-sqlite3 php8.1-xml php8.1-zip ${EXTENSIONS}
eatmydata apt-get install -y --no-install-recommends php-pear
phpdismod ffi gettext readline sysvmsg xsl

ln -s /usr/sbin/php-fpm8.1 /usr/sbin/php-fpm

if [ "${LITE_INSTALL}" != 'true' ]; then
PACKAGES="php8.1-dev"
if ! hash make > /dev/null 2>&1; then
PACKAGES="${PACKAGES} make"
fi

# shellcheck disable=SC2086
eatmydata apt-get install -y --no-install-recommends ${PACKAGES}
pecl channel-update pecl.php.net || true
pecl install timezonedb < /dev/null
echo "extension=timezonedb.so" > /etc/php/8.1/mods-available/timezonedb.ini
phpenmod timezonedb

# shellcheck disable=SC2086
eatmydata apt-get remove --purge -y ${PACKAGES}
fi

update-rc.d -f php8.1-fpm remove
update-rc.d -f anacron remove
rm -f /etc/cron.*/*anacron
}

setup_php82_deb() {
if [ "${LITE_INSTALL}" != 'true' ]; then
EXTENSIONS="ghostscript php8.2-bcmath php8.2-igbinary php8.2-intl php8.2-mcrypt php8.2-soap php8.2-ssh2"
Expand Down Expand Up @@ -543,13 +432,8 @@ case "${ID_LIKE}" in
apt-get update

case "${PHP_VERSION}" in
"8.0" | "8.1")
PHP_VERSION="8.1"
PHP_INI_DIR=/etc/php/8.1
setup_php81_deb
;;

"8.2")
"8.0" | "8.1" | "8.2")
PHP_VERSION="8.2"
PHP_INI_DIR=/etc/php/8.2
setup_php82_deb
;;
Expand Down Expand Up @@ -599,13 +483,8 @@ case "${ID_LIKE}" in
fi

case "${PHP_VERSION}" in
"8.0" | "8.1")
PHP_VERSION="8.1"
PHP_INI_DIR=/etc/php81
setup_php81_alpine
;;

"8.2")
"8.0" | "8.1" | "8.2")
PHP_VERSION="8.2"
PHP_INI_DIR=/etc/php82
setup_php82_alpine
;;
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.7.0",
"version": "1.7.1",
"description": "Configures Xdebug for the Dev Environment",
"options": {
"enabled": {
Expand Down
51 changes: 14 additions & 37 deletions features/src/xdebug/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,19 @@ get_php_version() {
fi
}

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

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

xdebug_82_alpine() {
apk add --no-cache php82-pecl-xdebug -X https://dl-cdn.alpinelinux.org/alpine/v3.22/community
rm -f /etc/php81/conf.d/50_xdebug.ini
rm -f /etc/php82/conf.d/50_xdebug.ini
}

xdebug_83_alpine() {
apk add --no-cache php83-pecl-xdebug
rm -f /etc/php81/conf.d/50_xdebug.ini
rm -f /etc/php83/conf.d/50_xdebug.ini
}

xdebug_84_alpine() {
apk add --no-cache php84-pecl-xdebug
rm -f /etc/php81/conf.d/50_xdebug.ini
}

xdebug_81_deb() {
apt-get install -y --no-install-recommends php8.1-xdebug
rm -f /etc/php84/conf.d/50_xdebug.ini
}

xdebug_82_deb() {
Expand Down Expand Up @@ -89,58 +72,52 @@ case "${ID_LIKE}" in
export DEBIAN_FRONTEND=noninteractive
apt-get update
case "${PHP_VERSION}" in
8.1)
xdebug_81_deb
;;
8.2)
xdebug_82_deb
;;
;;
8.3)
xdebug_83_deb
;;
;;
8.4)
xdebug_84_deb
;;
;;
*)
echo "(!) Unsupported PHP version: ${PHP_VERSION}"
exit 1
;;
;;
esac
PHP_INI_DIR="/etc/php/${PHP_VERSION}/mods-available"
NEED_ENMOD=1
SUFFIX=.debian
apt-get clean
rm -rf /var/lib/apt/lists/*
;;
;;

alpine)
case "${PHP_VERSION}" in
8.1)
xdebug_81_alpine
;;
8.2)
xdebug_82_alpine
;;
;;
8.3)
xdebug_83_alpine
;;
;;
8.4)
xdebug_84_alpine
;;
;;
*)
echo "(!) Unsupported PHP version: ${PHP_VERSION}"
exit 1
;;
;;
esac
VER="$(echo "${PHP_VERSION}" | tr -d '.')"
PHP_INI_DIR="/etc/php${VER}/conf.d"
SUFFIX=.alpine
;;
;;

*)
echo "(!) Unsupported distribution: ${ID_LIKE}"
exit 1
;;
;;
esac

sed "s/^xdebug\\.mode.*\$/xdebug.mode = \"${MODE}\"/" xdebug.ini > "${PHP_INI_DIR}/xdebug.ini"
Expand Down
Loading
Loading