Switch live-tests Apache setup to PHP-FPM (#3477)

* fix(ci): switch live-tests to PHP-FPM to avoid Ondrej PPA failures

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/f6ad9206-9be8-4447-ac64-86f1db428c60

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* fix(ci): restart php8.4-fpm after pool config update to pick up APP_ENV=test

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/15bfabb2-a837-4d51-9e2b-9c016fe2ad7d

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
authored and GitHub committed 2026-05-03 23:34:34 +01:00
1 parent d4ddf7e318
commit cdf1aa8329
1 file changed
+20 -14
+20 -14
View File
@@ -89,44 +89,50 @@ jobs:
- name: Setup Apache
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends \
libapache2-mod-php8.4 php8.4 php8.4-common php8.4-intl \
php8.4-mysql php8.4-xml php8.4-curl php8.4-fpm php8.4-mbstring \
php8.4-opcache php8.4-gd
sudo a2enmod php8.4
# Only install apache2 from the default Ubuntu repos — no Ondrej PPA needed.
# PHP 8.4 (including php8.4-fpm) was already installed by the Setup PHP step.
sudo apt-get install --no-install-recommends apache2
sudo a2enmod proxy_fcgi setenvif rewrite
sudo systemctl start apache2
sudo a2enmod rewrite
sudo mkdir /var/www/localhost
# sudo unzip "FOSSBilling Preview.zip" -d /var/www/localhost
sudo cp -r ./src/* /var/www/localhost
# Pass APP_ENV to the PHP-FPM pool so getenv('APP_ENV') works inside PHP.
# setup-php may have already started php8.4-fpm; use restart to ensure the
# updated pool config (with env[APP_ENV]) is reloaded.
echo "env[APP_ENV] = ${APP_ENV}" | sudo tee -a /etc/php/8.4/fpm/pool.d/www.conf
sudo systemctl restart php8.4-fpm
# Create a new Apache configuration file
sudo tee /etc/apache2/sites-available/localhost.conf > /dev/null <<EOF
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName localhost
DocumentRoot /var/www/localhost
<Directory /var/www/localhost>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
SetEnv APP_ENV ${APP_ENV}
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.4-fpm.sock|fcgi://localhost/"
</FilesMatch>
ErrorLog \${APACHE_LOG_DIR}/error.log
CustomLog \${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
EOF
# Enable the new configuration and disable the default one
sudo a2ensite localhost.conf
sudo a2dissite 000-default.conf
# Test the Apache configuration
sudo apache2ctl configtest
# Restart Apache
sudo systemctl restart apache2