Skip to content

feat: add php extensions#29

Open
ma-04 wants to merge 6 commits intoflywp:mainfrom
ma-04:feat/add_php_extentions
Open

feat: add php extensions#29
ma-04 wants to merge 6 commits intoflywp:mainfrom
ma-04:feat/add_php_extentions

Conversation

@ma-04
Copy link
Member

@ma-04 ma-04 commented Jan 22, 2026

Resolves #25

Notes

Installing sqlsrv and pdo_sqlsrv requires Microsoft ODBC driver. Microsoft download repository also has issues with curl in regards to ca-certificates.

Summary by CodeRabbit

  • New Features
    • Full Microsoft SQL Server support via integrated ODBC drivers, installed securely and made available at runtime
    • Expanded PHP extension set (MongoDB, PostgreSQL, LDAP, IMAP, gRPC, GMP, gettext, calendar, sqlsrv/pdo_sqlsrv, and more)
    • Updated image processing for PHP 8.3 (Imagick rebuilt for compatibility)
    • Additional runtime libraries included to support extended extensions and ODBC usage

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Walkthrough

Adds Microsoft ODBC driver installation and runtime copying; expands PHP extensions installed in the build stage to include many new extensions (pspell, pcntl, mongodb, ldap, imap, grpc, gmp, gettext, excimer, ev, calendar, xsl, sqlsrv, pdo_sqlsrv, pdo_pgsql) and updates runtime libraries.

Changes

Cohort / File(s) Summary
PHP Dockerfile
php/Dockerfile
Build stage: install Microsoft ODBC driver (arch-aware download, GPG verification), add many PHP extensions via docker-php-extension-installer (pspell, pcntl, mongodb, ldap, imap, grpc, gmp, gettext, excimer, ev, calendar, xsl, sqlsrv, pdo_sqlsrv, pdo_pgsql), handle Imagick for PHP 8.3. Final stage: add runtime deps (unixodbc, libpq, libldap, c-client, snappy, aspell-libs, libxslt, gmp, libavif, libxpm, etc.) and COPY /opt/microsoft and /etc/odbcinst.ini from builder into final image.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 I found packages, keys, and a comfy byte,
I hopped through layers to set drivers right,
Extensions tucked in, libraries in tow,
The image grows steady, ready to go,
Happy build hops — code sprouts in the night!

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'feat: add php extensions' is vague and generic, referring broadly to 'extensions' without specifying which ones or clarifying the substantial changes including ODBC driver installation. Consider a more specific title like 'feat: add PHP extensions and ODBC driver support' to better convey the primary changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed The PR successfully implements all 13 required PHP extensions from issue #25 (calendar, ev, excimer, gettext, gmp, grpc, imap, ldap, mongodb, pcntl, pdo_pgsql, pspell, xsl) and adds the noted sqlsrv and pdo_sqlsrv with necessary ODBC driver dependencies.
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issue #25 objectives: adding required PHP extensions, installing the Microsoft ODBC driver for sqlsrv/pdo_sqlsrv support, and adding necessary runtime dependencies.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@ma-04
Copy link
Member Author

ma-04 commented Jan 22, 2026

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@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

🤖 Fix all issues with AI agents
In `@php/Dockerfile`:
- Around line 37-40: The Dockerfile uses curl with the -k flag for the
msodbcsql18 and mssql-tools18 APKs (the download commands that fetch
msodbcsql18_18.6.1.1-1_${ARCH}.apk/.sig and
mssql-tools18_18.6.1.1-1_${ARCH}.apk/.sig); remove the -k option to re-enable
TLS certificate validation and replace with safer flags like --fail --show-error
--remote-name to fail on HTTP errors and surface issues, keeping the existing
GPG signature verification and ensuring ca-certificates is installed before
these curl commands.
- Around line 32-44: The Dockerfile currently installs msodbcsql18 and
mssql-tools only in the builder stage (the lines that download
msodbcsql18_18.6.1.1-1_${ARCH}.apk and mssql-tools18_18.6.1.1-1_${ARCH}.apk and
run apk add --allow-untrusted), so the final runtime image lacks the ODBC driver
and odbcinst.ini; update the Dockerfile to either move the entire driver install
block into the final stage or copy the installed artifacts
(msodbcsql18_18.6.1.1-1_${ARCH}.apk contents, mssql-tools files, and
odbcinst.ini) plus install the unixODBC runtime dependency into the final image
so sqlsrv / pdo_sqlsrv can find the driver at runtime.

@tareq1988
Copy link
Contributor

@ma-04 where are we on this?

@ma-04
Copy link
Member Author

ma-04 commented Feb 10, 2026

@CodeRabbit review

@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ma-04 ma-04 marked this pull request as ready for review February 10, 2026 06:29
@ma-04 ma-04 marked this pull request as draft February 10, 2026 06:29
Copy link

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
php/Dockerfile (1)

53-63: ⚠️ Potential issue | 🔴 Critical

Imagick source build for PHP 8.3 uses [[ ]] which requires bash, but Alpine's default shell is /bin/sh.

The RUN instruction uses [[ "$PHP_VERSION" == "8.3"* ]] which is a bash-ism. Docker's RUN uses /bin/sh by default on Alpine (which is ash). This will fail with a syntax error unless SHELL is overridden.

🐛 Fix: use POSIX-compatible test or set SHELL

Option 1 — POSIX-compatible pattern match:

-RUN if [[ "$PHP_VERSION" == "8.3"* ]]; then \
+RUN if echo "$PHP_VERSION" | grep -q "^8\.3"; then \

Option 2 — Use case:

-RUN if [[ "$PHP_VERSION" == "8.3"* ]]; then \
+RUN case "$PHP_VERSION" in 8.3*) \
         git clone https://github.com/Imagick/imagick.git /usr/src/php/ext/imagick && \
         ...
-    else \
-        install-php-extensions imagick; \
-    fi
+        ;; *) install-php-extensions imagick ;; esac
🤖 Fix all issues with AI agents
In `@php/Dockerfile`:
- Around line 84-88: The runtime image is missing several shared libraries
required by compiled PHP extensions and incorrectly includes the development
package libssh2-dev; update the RUN apk add line to remove libssh2-dev and add
the runtime libraries needed by extensions (e.g., libpq or postgresql-libs for
pdo_pgsql, libldap for ldap, c-client for imap, gmp for gmp, aspell-libs for
pspell, libxslt for xsl, and libintl/gettext for gettext) while keeping libssh2
(not libssh2-dev) and unixodbc present so extensions that link dynamically will
find their shared libraries at runtime.
🧹 Nitpick comments (2)
php/Dockerfile (2)

87-87: libssh2-dev should likely be libssh2 in the runtime stage.

Development headers (-dev packages) are unnecessary in the final image and increase image size. The runtime only needs the shared library.

♻️ Proposed fix
-    libssh2-dev lz4 libavif libxpm lz4-libs unixodbc && \
+    libssh2 lz4 libavif libxpm lz4-libs unixodbc && \

50-50: Verify the full extension list works across all target PHP versions.

This is a long single-line list of ~45 extensions. Some extensions (e.g., json is built-in since PHP 8.0, hash/pcre are always compiled in) may cause warnings or errors depending on the PHP version specified by PHP_VERSION (default 7.4). Also, sqlsrv/pdo_sqlsrv require the ODBC driver installed in the previous step—ensure the installer can find it.

Consider: if any single extension fails to install, the entire RUN layer fails. For extensions with complex or version-specific requirements, installing them in separate RUN steps (or grouping by risk) could improve debuggability.

@ma-04 ma-04 marked this pull request as ready for review February 10, 2026 06:52
@ma-04
Copy link
Member Author

ma-04 commented Feb 10, 2026

@tareq1988 vai, current status: all extensions are working without issues after adding runtime dependencies.

Tested with docker image flywp/php:8.3

image

Copy link

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
php/Dockerfile (1)

11-19: ⚠️ Potential issue | 🟡 Minor

WP-CLI package installation at build time requires GitHub authentication that is not provided.

The wp package install wp-cli/doctor-command:@stable --allow-root command at line 15 requires GitHub API access but no authentication token is available during the Docker build. This is indeed unrelated to the PHP extension installation in the builder stage, but it's a code issue in the Dockerfile itself, not merely an environment configuration problem. Either pass a GitHub token during build (--build-arg GITHUB_TOKEN=...) or remove the package installation from the build stage.

@ma-04
Copy link
Member Author

ma-04 commented Feb 10, 2026

Test failing due to dependency on fix: ci build failures php containers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

More PHP Extension Support

2 participants