fix(php-update): deduplicate old-version detection, complete multi-version config migration and cleanup - #226
Merged
Conversation
…RCE_PHP_VERS, fix double-sed replacements, loop cleanup over all old versions Agent-Logs-Url: https://github.com/EngineScript/EngineScript/sessions/80d3a537-5c8d-4cfa-9c4b-49e7ddc7a580 Co-authored-by: PDowney <11467177+PDowney@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix duplicate version detection in PHP update script
fix(php-update): deduplicate old-version detection, complete multi-version config migration and cleanup
May 2, 2026
Removed the entry for the PHP update on multi-version detection and cleanup fixes from the changelog.
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
PDowney
approved these changes
May 2, 2026
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves php-update.sh’s handling of environments where multiple older PHP-FPM versions are installed, ensuring configuration migration and cleanup are applied across all detected old versions.
Changes:
- Deduplicates detected old PHP versions during auto-detection.
- Introduces
MIGRATION_SOURCE_PHP_VERSand updates config migration to iterate over all detected old versions. - Updates removal/cleanup logic to loop over all detected old versions instead of only the first.
Comments suppressed due to low confidence (1)
scripts/update/php-update.sh:79
- With multiple old PHP versions installed, the script still stops only the first detected version (OLD_PHP_VERS[0]). This can leave the actually active php-fpm service running during the upgrade, and the log message implies all old PHP has been stopped. Consider stopping/disabling all versions in OLD_PHP_VERS (or whichever versions are active) before installing/reloading Nginx to make behavior consistent with the new multi-version migration/cleanup logic.
# Stop old PHP service
echo "Stopping PHP ${OLD_PHP_VER} service..."
systemctl stop "php${OLD_PHP_VER}-fpm" 2>/dev/null || true
Comment on lines
+60
to
+63
| # Keep backward-compatible single-version variable for legacy downstream logic. | ||
| # Migration logic must use MIGRATION_SOURCE_PHP_VERS to ensure all detected old versions are handled. | ||
| OLD_PHP_VER="${OLD_PHP_VERS[0]}" | ||
| MIGRATION_SOURCE_PHP_VERS=("${OLD_PHP_VERS[@]}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Software Version Updates
php-update.shhad several bugs when multiple old PHP versions are detected: only the first was used for config migration and cleanup, sed replacements could double-substitute, andOLD_PHP_VERScould silently contain duplicates.Changed Versions
scripts/update/php-update.sh— multi-version detection, migration, and cleanup fixesVersion Diff
Verification Checklist
Notes
Affected config targets:
/etc/nginx/globals/php-fpm.conf, all nginxsites-availableconfigs,phpsysinfo.ini, andapi.php. TheOLD_PHP_VERscalar is preserved unchanged for any downstream scripts that depend on it.Original prompt