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
39 changes: 19 additions & 20 deletions tests/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ health_checks() {
assert_output --partial "PHP ${FRANKENPHP_PHP_VERSION}"
refute_output --partial "Warning"
refute_output --partial "is already loaded"
refute_output --partial "cannot open shared object file"
refute_output --partial "in Unknown on line"

run ddev php --ini
assert_success
Expand Down Expand Up @@ -164,31 +166,28 @@ health_checks() {
assert_line "zip"

if [[ "${FRANKENPHP_CUSTOM_EXTENSION}" == "true" ]]; then
assert_output --partial "example_pie_extension"
assert_line "example_pie_extension"
else
refute_output --partial "example_pie_extension"
refute_line "example_pie_extension"
fi

run ddev xdebug on
assert_success

run ddev php -m
assert_success
assert_output --partial "xdebug"

run ddev xhprof on
assert_success

run ddev php -m
assert_success
assert_output --partial "xhprof"
refute_output --partial "Warning"
refute_output --partial "is already loaded"
refute_output --partial "cannot open shared object file"
refute_output --partial "in Unknown on line"

run ddev blackfire on
assert_success
for extension in xdebug xhprof blackfire; do
run ddev "${extension}" on
assert_success

run ddev php -m
assert_success
assert_output --partial "blackfire"
run ddev php -m
assert_success
assert_line "${extension}"
refute_output --partial "Warning"
refute_output --partial "is already loaded"
refute_output --partial "cannot open shared object file"
refute_output --partial "in Unknown on line"
done
}

teardown() {
Expand Down
24 changes: 22 additions & 2 deletions web-build/Dockerfile.frankenphp
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,35 @@ sed -i 's|/etc/php/${DDEV_PHP_VERSION}/fpm/conf.d/|/etc/php-zts/conf.d/|g' /star
# Copy DDEV PHP module configurations to php-zts location
cp /etc/php/${DDEV_PHP_VERSION}/mods-available/assert.ini /etc/php-zts/conf.d/20-assert.ini
cp /etc/php/${DDEV_PHP_VERSION}/mods-available/blackfire.ini /etc/php-zts/conf.d/90-blackfire.ini
cp /etc/php/${DDEV_PHP_VERSION}/mods-available/xdebug.ini /etc/php-zts/conf.d/15-xdebug.ini
cp /etc/php/${DDEV_PHP_VERSION}/mods-available/xhprof.ini /etc/php-zts/conf.d/20-xhprof.ini

# Append DDEV extension configurations to existing php-zts ini files
for EXT_NAME in xdebug xhprof; do
# Find the source extension ini file in mods-available
EXT_SRC_INI=$(find "/etc/php/${DDEV_PHP_VERSION}/mods-available" -name "*${EXT_NAME}*.ini" -type f | head -n 1)
if [ -z "$EXT_SRC_INI" ]; then
echo "ERROR: ${EXT_NAME} ini file not found in /etc/php/${DDEV_PHP_VERSION}/mods-available" >&2
exit 1
fi

# Find the destination extension ini file in php-zts conf.d
EXT_ZTS_INI=$(find /etc/php-zts/conf.d -name "*${EXT_NAME}*.ini" -type f | head -n 1)
if [ -z "$EXT_ZTS_INI" ]; then
echo "ERROR: ${EXT_NAME} ini file not found in /etc/php-zts/conf.d" >&2
exit 1
fi

# Append config from mods-available, excluding extension loading lines
grep -v -E '^(zend_)?extension=' "$EXT_SRC_INI" >> "$EXT_ZTS_INI"
done

# Create symlinks for phpenmod and phpdismod to use php-zts versions
ln -sf /usr/sbin/phpenmod-zts /usr/sbin/phpenmod
ln -sf /usr/sbin/phpdismod-zts /usr/sbin/phpdismod

# Reconfigure blackfire-php if installed, to match the current PHP version
if dpkg -s blackfire-php >/dev/null 2>&1; then
apt-get update || true
apt-get install -y --only-upgrade blackfire-php
dpkg-reconfigure blackfire-php
fi

Expand Down