Skip to content

🐳 Install PHP 8.4 + 8.5 with common extensions#9

Merged
rickyheijnen merged 1 commit intomainfrom
feat/install-php
Dec 24, 2025
Merged

🐳 Install PHP 8.4 + 8.5 with common extensions#9
rickyheijnen merged 1 commit intomainfrom
feat/install-php

Conversation

@rickyheijnen
Copy link
Copy Markdown
Member

@rickyheijnen rickyheijnen commented Dec 24, 2025

🔍 Samenvatting

Deze PR is een aanvulling op #8.

📝 Beschrijving

  • Installeer ook PHP 8.4 + 8.5
  • Installeer extra extenties
  • Configureer de default PHP

✅ Checklist

  • Code is lokaal getest
  • Tests zijn toegevoegd/aangepast
  • Documentatie bijgewerkt (indien nodig)

@rickyheijnen rickyheijnen self-assigned this Dec 24, 2025
@rickyheijnen rickyheijnen added the type: ✨ feature Request or addition of new functionality label Dec 24, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Dec 24, 2025

Walkthrough

Dockerfile pins the runner base image to ghcr.io/actions/actions-runner:2.329.0, expands PHP support to 8.1–8.5 with per-version apt install blocks and common extensions, registers each PHP version via update-alternatives (defaulting to 8.5), and installs Composer after configuring PHP alternatives. README documents these changes.

Changes

Cohort / File(s) Summary
Docker image configuration
Dockerfile
Pinned base image to ghcr.io/actions/actions-runner:2.329.0; added per-version PHP apt-install blocks for PHP 8.1, 8.2, 8.3, 8.4, and 8.5 with common extensions (mysqli, pdo_mysql, opcache, intl, etc.); configured update-alternatives for php, phpize, and php-config for all versions and set 8.5 as default; moved Composer installation to a dedicated step after alternatives; retained AWS CLI and existing post-install steps.
Documentation
README.md
Updated to document PHP multi-version support (8.1–8.5), that PHP 8.5 is the default, and that Composer is installed globally.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding PHP 8.4 and 8.5 with common extensions, which matches the primary focus of the changeset.
Description check ✅ Passed The description is related to the changeset, outlining the key objectives of installing PHP 8.4/8.5, adding extensions, and configuring default PHP, though written in Dutch.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/install-php

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4eceeda and b174f8e.

📒 Files selected for processing (2)
  • Dockerfile
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build Check
🔇 Additional comments (5)
Dockerfile (5)

1-1: LGTM: Base image properly pinned.

Pinning to a specific version (2.329.0) ensures reproducible builds and prevents unexpected breaking changes from upstream updates.


47-126: LGTM: PHP installation structure is well-organized.

The entire PHP installation is properly consolidated into a single RUN command with apt cleanup at the end (lines 125-126), which resolves the static analysis concern about apt lists. All PHP versions 8.1-8.5 are installed with consistent extension sets.


128-134: LGTM: PHP alternatives configuration is correct.

All PHP versions 8.1-8.5 are properly registered with appropriate priorities, and PHP 8.5 is correctly set as the default. The comment accurately reflects the implementation.


136-140: LGTM: Composer installation follows best practices.

The Composer installer correctly omits the --version flag (which was properly removed based on previous feedback), allowing it to default to the latest stable release. Installation directory and permissions are configured appropriately.


112-124: No further action needed—PHP 8.5 is now officially available in the ondrej/php PPA.

PHP 8.5 reached general availability on November 20, 2025, and is actively maintained in ondrej/php PPA (current version 8.5.1 as of December 18, 2025) for Ubuntu 22.04 and 24.04. All packages in the Dockerfile snippet are available and the build should not fail due to missing dependencies.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c43601e and c547859.

📒 Files selected for processing (2)
  • Dockerfile
  • README.md
🔇 Additional comments (3)
README.md (1)

28-28: LGTM!

The Composer documentation accurately reflects the installation in the Dockerfile.

Dockerfile (2)

47-92: LGTM!

The common extensions (mysqli, pdo-mysql, opcache) are consistently added across all PHP versions. This provides a solid foundation for most PHP applications.


93-106: LGTM!

PHP 8.4 installation with consistent extensions across all versions.

@rickyheijnen rickyheijnen force-pushed the feat/install-php branch 2 times, most recently from f51e63a to bf64920 Compare December 24, 2025 14:58
@rickyheijnen rickyheijnen changed the title 🐳 Install PHP 8.2, 8.3, 8.4 with common extensions and Composer 🐳 Install PHP 8.4 with common extensions and Composer Dec 24, 2025
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
Dockerfile (1)

51-64: Minor: Consider reordering extensions for consistency.

The extension list for PHP 8.1 has php8.1-opcache before php8.1-intl (lines 63-64), while PHP 8.2, 8.3, and 8.4 have intl before opcache. Although this doesn't affect functionality, maintaining consistent ordering improves maintainability.

🔎 Proposed fix for consistent ordering
     php8.1-zip \
     php8.1-bcmath \
-    php8.1-opcache \
     php8.1-intl \
+    php8.1-opcache \
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f51e63a and bf64920.

📒 Files selected for processing (2)
  • Dockerfile
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build Check
🔇 Additional comments (3)
Dockerfile (3)

110-115: Previous issue resolved: PHP 8.1 now registered.

The previous review comment about PHP 8.1 not being registered with update-alternatives has been addressed. All PHP versions (8.1–8.4) are now properly registered with appropriate priority values, and PHP 8.4 is correctly set as the default.


117-121: Previous issue resolved: Composer installation corrected.

The previous review comment about the invalid --version=latest flag has been addressed. The Composer installation now correctly omits the version flag, allowing the installer to default to the latest stable release as intended.


93-106: PHP 8.4 is available in the ondrej/php PPA.

PHP 8.4 and all specified extensions (curl, gd, mbstring, mysqli, pdo-mysql, xml, zip, bcmath, intl, opcache) are available in the ppa:ondrej/php repository. Multiple builds are supported for Jammy, Noble, and various architectures including amd64 and arm64.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bf64920 and 765af66.

📒 Files selected for processing (2)
  • Dockerfile
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md
🔇 Additional comments (2)
Dockerfile (2)

132-136: LGTM! Composer installation is correct.

The Composer installation follows best practices:

  • Uses the official installer
  • Omits --version to install the latest stable release by default
  • Sets proper permissions

The previous issue regarding --version=latest has been successfully addressed ✅


107-120: The concern about PHP 8.5 availability and PR scope is no longer applicable.

PHP 8.5 reached general availability on November 20, 2025, and the git commit history confirms both PHP 8.4 and 8.5 were intentionally included in this PR ("Install PHP 8.4 + 8.5 with common extensions"). With PHP 8.5.1 now released (December 18, 2025) and active security support through 2029, the original concern about stability is outdated.

Likely an incorrect or invalid review comment.

@rickyheijnen rickyheijnen changed the title 🐳 Install PHP 8.4 with common extensions and Composer 🐳 Install PHP 8.4 + 8.5 with common extensions Dec 24, 2025
@rickyheijnen rickyheijnen reopened this Dec 24, 2025
@rickyheijnen rickyheijnen force-pushed the feat/install-php branch 2 times, most recently from a651915 to 4eceeda Compare December 24, 2025 15:21
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
Dockerfile (1)

52-131: Consider consolidating PHP installation RUN commands.

The five separate RUN commands for PHP installations create multiple Docker layers and, except for PHP 8.5, don't clean up apt caches. Consolidating them would reduce image size and simplify maintenance.

🔎 Proposed consolidation
 # Add PHP repository and install PHP 8.1, 8.2, 8.3, 8.4, 8.5 and common extensions
 RUN add-apt-repository -y ppa:ondrej/php \
- && apt-get update
-
-# PHP 8.1 with common extensions
-RUN apt-get install -y --no-install-recommends \
+ && apt-get update \
+ && apt-get install -y --no-install-recommends \
+    # PHP 8.1 with common extensions
     php8.1 \
     php8.1-cli \
     php8.1-common \
     php8.1-curl \
     php8.1-gd \
     php8.1-mbstring \
     php8.1-mysqli \
     php8.1-pdo-mysql \
     php8.1-xml \
     php8.1-zip \
     php8.1-bcmath \
     php8.1-opcache \
-    php8.1-intl
-
- # PHP 8.2 with common extensions
-RUN apt-get install -y --no-install-recommends \
+    php8.1-intl \
+    # PHP 8.2 with common extensions
     php8.2 \
     php8.2-cli \
     php8.2-common \
     php8.2-curl \
     php8.2-gd \
     php8.2-mbstring \
     php8.2-mysqli \
     php8.2-pdo-mysql \
     php8.2-xml \
     php8.2-zip \
     php8.2-bcmath \
     php8.2-intl \
-    php8.2-opcache
-
-# PHP 8.3 with common extensions
-RUN apt-get install -y --no-install-recommends \
+    php8.2-opcache \
+    # PHP 8.3 with common extensions
     php8.3 \
     php8.3-cli \
     php8.3-common \
     php8.3-curl \
     php8.3-gd \
     php8.3-mbstring \
     php8.3-mysqli \
     php8.3-pdo-mysql \
     php8.3-xml \
     php8.3-zip \
     php8.3-bcmath \
     php8.3-intl \
-    php8.3-opcache
-
-# PHP 8.4 with common extensions
-RUN apt-get install -y --no-install-recommends \
+    php8.3-opcache \
+    # PHP 8.4 with common extensions
     php8.4 \
     php8.4-cli \
     php8.4-common \
     php8.4-curl \
     php8.4-gd \
     php8.4-mbstring \
     php8.4-mysqli \
     php8.4-pdo-mysql \
     php8.4-xml \
     php8.4-zip \
     php8.4-bcmath \
     php8.4-intl \
-    php8.4-opcache
-
-# PHP 8.5 with common extensions
-RUN apt-get install -y --no-install-recommends \
+    php8.4-opcache \
+    # PHP 8.5 with common extensions
     php8.5 \
     php8.5-cli \
     php8.5-common \
     php8.5-curl \
     php8.5-gd \
     php8.5-mbstring \
     php8.5-mysqli \
     php8.5-pdo-mysql \
     php8.5-xml \
     php8.5-zip \
     php8.5-bcmath \
     php8.5-intl \
     php8.5-opcache \
  && apt-get clean \
  && rm -rf /var/lib/apt/lists/*

This consolidation:

  • Reduces Docker layers from 6 to 1
  • Ensures apt cache is cleaned up once at the end
  • Resolves both DL3009 and DL3059 static analysis warnings
  • Makes the Dockerfile more maintainable
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1164cfa and a651915.

📒 Files selected for processing (2)
  • Dockerfile
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md
🧰 Additional context used
🪛 GitHub Actions: Code Lint
Dockerfile

[error] 48-48: Hadolint DL3009: Delete the apt-get lists after installing something.

🪛 GitHub Check: Lint Dockerfile
Dockerfile

[failure] 100-100:
DL3059 info: Multiple consecutive RUN instructions. Consider consolidation.


[failure] 84-84:
DL3059 info: Multiple consecutive RUN instructions. Consider consolidation.


[failure] 68-68:
DL3059 info: Multiple consecutive RUN instructions. Consider consolidation.


[failure] 48-48:
DL3009 info: Delete the apt-get lists after installing something

🔇 Additional comments (4)
Dockerfile (4)

1-1: LGTM: Base image pinned for reproducibility.

Pinning the runner base image to a specific version ensures consistent builds and prevents unexpected breakage from upstream changes.


133-139: LGTM: PHP alternatives configured correctly.

All PHP versions (8.1-8.5) are properly registered with update-alternatives, and PHP 8.5 is set as the default as intended. The comment accurately reflects the implementation.


141-145: LGTM: Composer installation follows best practices.

The Composer installation correctly uses the official installer without the invalid --version=latest flag (as addressed in previous reviews), allowing it to default to the latest stable release.


115-131: No issues found. PHP 8.5 was officially released as stable GA on November 20, 2025, and all referenced packages (php8.5, php8.5-cli, and all listed extensions) are available in the ondrej/php PPA for supported Ubuntu series (Jammy/22.04 and Noble/24.04). The build will not fail due to missing packages.

Likely an incorrect or invalid review comment.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
Dockerfile (1)

47-49: Consider consolidating PHP installations to reduce image size.

The apt-get update creates cached lists that persist across multiple intermediate layers (through PHP 8.1-8.4 installations) until cleanup at line 129-130. While the final image is cleaned, this approach increases intermediate layer sizes.

💡 Consolidation approach

Combine the repository setup and all PHP installations into a single RUN statement:

-# Add PHP repository and install PHP 8.1, 8.2, 8.3, 8.4, 8.5 and common extensions
-RUN add-apt-repository -y ppa:ondrej/php \
- && apt-get update
-
-# PHP 8.1 with common extensions
-RUN apt-get install -y --no-install-recommends \
+# Add PHP repository and install PHP 8.1, 8.2, 8.3, 8.4, 8.5 and common extensions
+RUN add-apt-repository -y ppa:ondrej/php \
+ && apt-get update \
+ && apt-get install -y --no-install-recommends \
+    # PHP 8.1
     php8.1 \
     php8.1-cli \
     ...
+    # PHP 8.2
+    php8.2 \
+    php8.2-cli \
+    ...
+    # (continue for all versions)
+ && apt-get clean \
+ && rm -rf /var/lib/apt/lists/*

This reduces the number of layers and ensures apt cache doesn't persist in intermediate layers.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a651915 and 4eceeda.

📒 Files selected for processing (2)
  • Dockerfile
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md
🧰 Additional context used
🪛 GitHub Actions: Code Lint
Dockerfile

[error] 48-48: Hadolint DL3009: Delete the apt-get lists after installing something.

🪛 GitHub Check: Lint Dockerfile
Dockerfile

[failure] 100-100:
DL3059 info: Multiple consecutive RUN instructions. Consider consolidation.


[failure] 84-84:
DL3059 info: Multiple consecutive RUN instructions. Consider consolidation.


[failure] 68-68:
DL3059 info: Multiple consecutive RUN instructions. Consider consolidation.


[failure] 48-48:
DL3009 info: Delete the apt-get lists after installing something

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build Check
🔇 Additional comments (8)
Dockerfile (8)

52-65: PHP 8.1 extension set looks good.

The extension list is comprehensive and includes common requirements (database, image processing, cryptography, internationalization).


67-81: PHP 8.2 extension set looks good.

Extension list is consistent with the other PHP versions.


83-97: PHP 8.3 extension set looks good.

Extension list is consistent with the other PHP versions.


99-113: PHP 8.4 installation looks good.

Extension set is consistent with other PHP versions. This addresses one of the PR objectives.


132-138: PHP alternatives configuration looks correct.

All PHP versions (8.1-8.5) are properly registered with update-alternatives, and PHP 8.5 is set as the default, consistent with the comment.


140-144: Composer installation looks good.

The installation correctly omits the version flag, allowing the installer to default to the latest stable release. This addresses the previous review concern.


1-1: The base image ghcr.io/actions/actions-runner:2.329.0 is valid and available in the GitHub Container Registry. This version was released on October 14, 2025, and can be pulled without issues.


115-130: PHP 8.5 is available in the ondrej/php PPA and the Dockerfile code is valid.

PHP 8.5 was released GA on November 20, 2025, and is now available in Ondřej Surý's PPA (ppa:ondrej/php) with all requested extensions. Version 8.5.1 is current as of December 2025. The installation will not fail due to package unavailability.

@rickyheijnen rickyheijnen merged commit d72bef9 into main Dec 24, 2025
3 checks passed
@rickyheijnen rickyheijnen deleted the feat/install-php branch December 24, 2025 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: ✨ feature Request or addition of new functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant