# Has to be run as admin
-# To be kept in sync with setup_php_travis.sh
-
+# @todo make it optional to install xdebug. It is fe. missing in sury's ppa for Xenial
+# @todo make it optional to install fpm. It is not needed for the cd workflow
# @todo make it optional to disable xdebug ?
set -e
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
+ for PHP_CURRENT in $(dpkg -l | grep -E 'php.+-common' | awk '{print $2}'); do
+ if [ "${PHP_CURRENT}" != "php${PHP_VERSION}-common" ]; then
+ apt-get purge -y "${PHP_CURRENT}"
+ fi
+ done
+
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
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 daeamon-reload
+ systemctl daemon-reload
fi
fi
service php-fpm start
-# configure apache
-a2enconf php${PHPVER}-fpm
-service apache2 restart
+# configure apache (if installed)
+if [ -n "$(dpkg --list | grep apache)" ]; then
+ a2enconf php${PHPVER}-fpm
+ service apache2 restart
+fi