Skip to content

Commit

Permalink
Startup PHP-FPM versions by looping through the service list instead …
Browse files Browse the repository at this point in the history
…of having the PHP installer update the startup script.
  • Loading branch information
patrickcarlohickman committed Feb 2, 2024
1 parent 7bcec18 commit 44d4e9b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ This setup is designed to allow multiple versions of PHP running at the same tim
- Setup a new PHP log file for the version installed
- Configure the PHP-FPM user and listener
- Install the PHP-FPM service script
- Update the `/usr/local/bin/startup.sh` script to include the new PHP-FPM service

## Enable new websites

Expand Down
9 changes: 0 additions & 9 deletions setup/installers/install-php.sh
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ readonly PHPFPM_ROOT="${PHP_VERSION_ROOT}"
readonly PHPFPM_SOCK="var/run/php-fpm.sock"
readonly PHPFPM_SERVICE_FILE="${PHPFPM_ROOT}/etc/init.d/php-fpm"
readonly PHPFPM_SERVICE_NAME="php-fpm-${PHP_VERSION_INSTALL}"
readonly STARTUP_SCRIPT="/usr/local/bin/startup.sh"

# PHP-FPM config location changed in 7.0.
# See: https://github.com/php/php-src/blob/php-7.0.0/sapi/fpm/Makefile.frag
Expand Down Expand Up @@ -297,12 +296,4 @@ log_info "Installing PHP-FPM service script as ${PHPFPM_SERVICE_NAME}."

cp "${PHPFPM_SERVICE_FILE}" "/etc/init.d/${PHPFPM_SERVICE_NAME}"

if [ -f "${STARTUP_SCRIPT}" ]; then
log_info "Adding PHP-FPM service ${PHPFPM_SERVICE_NAME} to startup script."

cat << EOF >> "${STARTUP_SCRIPT}"
service ${PHPFPM_SERVICE_NAME} restart
EOF
fi

log_info "PHP version ${PHP_VERSION_INSTALL} install complete!"
7 changes: 7 additions & 0 deletions setup/resources/wsl/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,10 @@ done
service redis-server restart
service mysql restart
service apache2 restart

# Loop through all the PHP-FPM services and restart them.
for phpfpm in `service --status-all 2>&1 | grep -o php-fpm.*`
do
echo "Restarting service $phpfpm."
service $phpfpm restart
done

0 comments on commit 44d4e9b

Please sign in to comment.