From 780276e537e9aa8f2afd5aedfa7b5674b8641bd6 Mon Sep 17 00:00:00 2001 From: gggeek Date: Thu, 24 Nov 2022 17:25:55 +0000 Subject: [PATCH] make it possible to build test vm w. bionic/php5.5 --- tests/ci/setup/setup_php.sh | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/ci/setup/setup_php.sh b/tests/ci/setup/setup_php.sh index ff326f6a..f7e1415f 100755 --- a/tests/ci/setup/setup_php.sh +++ b/tests/ci/setup/setup_php.sh @@ -8,6 +8,8 @@ set -e +echo "Installing PHP version '${1}'..." + SCRIPT_DIR="$(dirname -- "$(readlink -f "$0")")" configure_php_ini() { @@ -16,6 +18,7 @@ configure_php_ini() { echo "always_populate_raw_post_data = -1" >> "${1}" # we disable xdebug for speed for both cli and web mode + # @todo make this optional if which phpdismod >/dev/null 2>/dev/null; then phpdismod xdebug elif [ -f /usr/local/php/$PHP_VERSION/etc/conf.d/20-xdebug.ini ]; then @@ -28,6 +31,8 @@ PHP_VERSION="$1" DEBIAN_VERSION="$(lsb_release -s -c)" if [ "${PHP_VERSION}" = default ]; then + echo "Using native PHP packages..." + if [ "${DEBIAN_VERSION}" = jessie -o "${DEBIAN_VERSION}" = precise -o "${DEBIAN_VERSION}" = trusty ]; then PHPSUFFIX=5 else @@ -51,7 +56,9 @@ else done if [ "${PHP_VERSION}" = 5.3 -o "${PHP_VERSION}" = 5.4 -o "${PHP_VERSION}" = 5.5 ]; then - # @todo this set of packages has only been tested on Focal and Jammy so far + echo "Using PHP from shivammathur/php5-ubuntu..." + + # @todo this set of packages has only been tested on Bionic, Focal and Jammy so far if [ "${DEBIAN_VERSION}" = jammy ]; then ENCHANTSUFFIX='-2' fi @@ -79,11 +86,17 @@ else # we have to do this as the init script we get for starting/stopping php-fpm seems to be faulty... pkill php-fpm + rm -rf "/usr/local/php/${PHP_VERSION}/var/run" + ln -s "/var/run/php" "/usr/local/php/${PHP_VERSION}/var/run" + # set up the minimal php-fpm config we need echo 'listen = /run/php/php-fpm.sock' >> "/usr/local/php/${PHP_VERSION}/etc/php-fpm.conf" # the user running apache will be different in GHA and local VMS. We just open fully perms on the fpm socket echo 'listen.mode = 0666' >> "/usr/local/php/${PHP_VERSION}/etc/php-fpm.conf" + # as well as the conf to enable php-fpm in apache cp "$SCRIPT_DIR/../config/apache_phpfpm_proxyfcgi" "/etc/apache2/conf-available/php${PHP_VERSION}-fpm.conf" else + echo "Using PHP packages from ondrej/php..." + DEBIAN_FRONTEND=noninteractive apt-get install -y language-pack-en-base software-properties-common LC_ALL=en_US.UTF-8 add-apt-repository ppa:ondrej/php apt-get update @@ -103,6 +116,8 @@ fi PHPVER=$(php -r 'echo implode(".",array_slice(explode(".",PHP_VERSION),0,2));' 2>/dev/null) +service "php${PHPVER}-fpm" stop || true + if [ -d /etc/php/${PHPVER}/fpm ]; then configure_php_ini /etc/php/${PHPVER}/fpm/php.ini elif [ -f /usr/local/php/${PHPVER}/etc/php.ini ]; then @@ -111,7 +126,6 @@ fi # use a nice name for the php-fpm service, so that it does not depend on php version running. Try to make that work # both for docker and VMs -service "php${PHPVER}-fpm" stop if [ -f "/etc/init.d/php${PHPVER}-fpm" ]; then ln -s "/etc/init.d/php${PHPVER}-fpm" /etc/init.d/php-fpm fi @@ -128,6 +142,7 @@ service php-fpm start # reconfigure apache (if installed). Sadly, php will switch on mod-php and mpm_prefork at install time... if [ -n "$(dpkg --list | grep apache)" ]; then + echo "Reconfiguring Apache..." if [ -n "$(ls /etc/apache2/mods-enabled/php* 2>/dev/null)" ]; then rm /etc/apache2/mods-enabled/php* fi @@ -136,3 +151,5 @@ if [ -n "$(dpkg --list | grep apache)" ]; then a2enconf php${PHPVER}-fpm service apache2 restart fi + +echo "Done installing PHP" -- 2.47.0