Skip to content

Conversation

@f3l1x
Copy link
Member

@f3l1x f3l1x commented Jan 26, 2026

Summary

This PR adds MongoDB extension support to the Amazon Linux 2023 PHP 8.4 runtime layer. Since the MongoDB extension is not available as a native AL2023 package, it is compiled from PECL source during the Docker build process.

Key Changes

  • Dockerfile: Added installation and compilation of MongoDB extension from PECL
    • Installs required build dependencies (php-devel, php-pear, openssl-devel)
    • Compiles MongoDB extension via pecl install mongodb
    • Registers the extension in PHP configuration
    • Patches the compiled .so file with correct runtime library paths
  • Makefile: Added extraction of the compiled mongodb.so module to the distribution directory
  • php.ini: Enabled the MongoDB extension in the PHP configuration

Implementation Details

  • The MongoDB extension is compiled from PECL rather than using a native package, as it's not available in AL2023 repositories
  • The compiled module is located at /usr/lib64/php/modules/mongodb.so (different path from native packages at /usr/lib64/php8.4/modules/)
  • patchelf is used to set the correct runtime library search path ($ORIGIN) for the compiled extension, ensuring portability in the Lambda environment
  • The extension is enabled via a dedicated configuration file (50-mongodb.ini) and also listed in the main php.ini

Install MongoDB PHP extension from PECL for PHP 8.4 on Amazon Linux 2023,
since native AL2023 packages don't include mongodb-pecl.
Install MongoDB PHP extension from PECL for PHP 8.5 on AlmaLinux 9,
since Remi repository may not have mongodb-pecl package for PHP 8.5 yet.
- Builds Docker image for amazon-linux-2023-v84
- Validates PHP version
- Validates MongoDB extension is loaded and functional
- Triggers on changes to v84 files or workflow dispatch
Use php-pear (generic package) instead of php8.4-pear which doesn't
exist in Amazon Linux 2023.
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.

3 participants