[PR #6141] [core]: tools.func: increase setup_php function #6398

Open
opened 2025-11-20 07:10:26 -05:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/community-scripts/ProxmoxVE/pull/6141

State: closed
Merged: Yes


✍️ Description

Refined the setup_php function to reduce redundant operations and handle PHP/Apache setup more intelligently.


🔧 Changes

  • Removed redundant base-package validation loop:
    Dropped unnecessary apt-cache show loop for the base PHP package.

  • Conditional Apache installation:
    Now installs apache2 and libapache2-mod-php only if PHP_APACHE=YES and they are not already installed.

  • Module validation improved:
    Checks availability of each requested module individually, logging a warning if a module is not found.

  • Avoid repeated Apache service manipulation:
    Ensures a2enmod and a2dismod are only called when necessary, prevents redundant restarts.

  • Explicitly enables mpm_prefork when setting up Apache:
    Guarantees correct MPM configuration for PHP.

  • Improved idempotency:
    Skips reinstallation of Apache/PHP if already installed and matches the requested version.

Prerequisites (X in brackets)

  • Self-review completed – Code follows project standards.
  • Tested thoroughly – Changes work as expected.
  • No security risks – No hardcoded secrets, unnecessary privilege escalations, or permission issues.

🛠️ Type of Change (X in brackets)

  • 🐞 Bug fix – Resolves an issue without breaking functionality.
  • New feature – Adds new, non-breaking functionality.
  • 💥 Breaking change – Alters existing functionality in a way that may require updates.
  • 🆕 New script – A fully functional and tested script or script set.
  • 🌍 Website update – Changes to website-related JSON files or metadata.
  • 🔧 Refactoring / Code Cleanup – Improves readability or maintainability without changing functionality.
  • 📝 Documentation update – Changes to README, AppName.md, CONTRIBUTING.md, or other docs.
**Original Pull Request:** https://github.com/community-scripts/ProxmoxVE/pull/6141 **State:** closed **Merged:** Yes --- ## ✍️ Description Refined the `setup_php` function to reduce redundant operations and handle PHP/Apache setup more intelligently. --- ## 🔧 Changes - **Removed redundant base-package validation loop:** Dropped unnecessary `apt-cache show` loop for the base PHP package. - **Conditional Apache installation:** Now installs `apache2` and `libapache2-mod-php` only if `PHP_APACHE=YES` and they are not already installed. - **Module validation improved:** Checks availability of each requested module individually, logging a warning if a module is not found. - **Avoid repeated Apache service manipulation:** Ensures `a2enmod` and `a2dismod` are only called when necessary, prevents redundant restarts. - **Explicitly enables `mpm_prefork` when setting up Apache:** Guarantees correct MPM configuration for PHP. - **Improved idempotency:** Skips reinstallation of Apache/PHP if already installed and matches the requested version. ## ✅ Prerequisites (**X** in brackets) - [x] **Self-review completed** – Code follows project standards. - [x] **Tested thoroughly** – Changes work as expected. - [x] **No security risks** – No hardcoded secrets, unnecessary privilege escalations, or permission issues. --- ## 🛠️ Type of Change (**X** in brackets) - [ ] 🐞 **Bug fix** – Resolves an issue without breaking functionality. - [ ] ✨ **New feature** – Adds new, non-breaking functionality. - [ ] 💥 **Breaking change** – Alters existing functionality in a way that may require updates. - [ ] 🆕 **New script** – A fully functional and tested script or script set. - [ ] 🌍 **Website update** – Changes to website-related JSON files or metadata. - [x] 🔧 **Refactoring / Code Cleanup** – Improves readability or maintainability without changing functionality. - [ ] 📝 **Documentation update** – Changes to `README`, `AppName.md`, `CONTRIBUTING.md`, or other docs.
saavagebueno added the pull-request label 2025-11-20 07:10:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/ProxmoxVE#6398