wip github actions CI
[plcapi.git] / tests / ci / setup / setup_php.sh
index ad16d3d..1144910 100755 (executable)
@@ -37,6 +37,9 @@ if [ "${PHP_VERSION}" = default ]; then
         php${PHPSUFFIX}-mbstring \
         php${PHPSUFFIX}-xdebug
 else
+    # on GHA runners ubuntu version, php 7.4 and 8.0 seem to be preinstalled. remove them if found
+
+
     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
@@ -57,9 +60,18 @@ PHPVER=$(php -r 'echo implode(".",array_slice(explode(".",PHP_VERSION),0,2));' 2
 
 configure_php_ini /etc/php/${PHPVER}/fpm/php.ini
 
-# use a nice name for the php-fpm service, so that it does not depend on php version running
+# 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
-ln -s "/etc/init.d/php${PHPVER}-fpm" /etc/init.d/php-fpm
+if [ -f "/etc/init.d/php${PHPVER}-fpm" ]; then
+    ln -s "/etc/init.d/php${PHPVER}-fpm" /etc/init.d/php-fpm
+fi
+if [ -f "/lib/systemd/system/php${PHPVER}-fpm.service" ]; then
+    ln -s "/lib/systemd/system/php${PHPVER}-fpm.service" /lib/systemd/system/php-fpm.service
+    if [ ! -f /.dockerenv ]; then
+        systemctl daemon-reload
+    fi
+fi
 
 # @todo shall we configure php-fpm?