Hello NixOS community,
I am facing an issue with enabling the MongoDB extension for any PHP version (I tested with PHP82, PHP83, and PHP84 on my x86_64 system).
The issue appears when running composer update
within a Symfony project.
Earlier I tried to install the Mongodb-Extension like this in the configuration.nix:
php83
php83Extensions.mongodb
php83Packages.composer
However, in this case, no mongodb-extension was recognized by PHP when running php -m
, so I switched to this config:
(pkgs.php83.buildEnv {
extensions = ({enabled, all}: enabled ++ (with all; [
mongodb
]));
})
pkgs.php83Packages.composer
Now the mongodb extension is recognized. When looking up the version of the extension, it shows 1.20.1, so the latest version of the package from the nixstore.
php --re mongodb | head -1
Extension [ <persistent> extension #54 mongodb version 1.20.1 ] {
But now when running composer update
I get this error:
composer update
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "7.0.*"
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Root composer.json requires doctrine/mongodb-odm-bundle ^5.0 -> satisfiable by doctrine/mongodb-odm-bundle[5.0.0, ..., 5.1.2].
- doctrine/mongodb-odm-bundle[5.0.0, ..., 5.0.1] require ext-mongodb ^1.5 -> it is missing from your system. Install or enable PHP's mongodb extension.
Alternatively you can require one of these packages that provide the extension (or parts of it):
- soyuka/stubs-mongodb ext-mongodb stubs taken from https://github.com/JetBrains/phpstorm-stubs
- svk/yc-mongodb-injector Интеграция драйвера mongodb для php 7.4.4 в Cloud Functions Яндекс.Об�
- devture/nagadmin Web-configurator and frontend for Nagios
- gepur-it/report-bundle Gepur ERP Report generation bundle
- malith124/stubs-mongodb-11 ext-mongodb stubs taken from https://github.com/JetBrains/phpstorm-stubs
- doctrine/mongodb-odm-bundle[5.0.2, ..., 5.1.2] require ext-mongodb ^1.16 -> it is missing from your system. Install or enable PHP's mongodb extension.
Alternatively you can require one of these packages that provide the extension (or parts of it):
- soyuka/stubs-mongodb ext-mongodb stubs taken from https://github.com/JetBrains/phpstorm-stubs
- svk/yc-mongodb-injector Интеграция драйвера mongodb для php 7.4.4 в Cloud Functions Яндекс.Об�
- devture/nagadmin Web-configurator and frontend for Nagios
- gepur-it/report-bundle Gepur ERP Report generation bundle
- malith124/stubs-mongodb-11 ext-mongodb stubs taken from https://github.com/JetBrains/phpstorm-stubs
To enable extensions, verify that they are enabled in your .ini files:
- /nix/store/7fbkvqm20a0fj0w5qaw4hrnj5sxh127f-php-with-extensions-8.3.15/lib/php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-mongodb` to temporarily ignore these required extensions.
Does anyone have the same issue or could please help me?
My composer.json:
{
"type": "project",
"license": "proprietary",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=8.2",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/mongodb-odm-bundle": "^5.0",
"dompdf/dompdf": "^2.0",
"eddturtle/qpdf-php": "^1.0",
"mikehaertl/php-pdftk": "^0.13.1",
"symfony/console": "7.0.*",
"symfony/dotenv": "7.0.*",
"symfony/flex": "^2",
"symfony/framework-bundle": "7.0.*",
"symfony/mime": "7.0.*",
"symfony/monolog-bundle": "^3.10",
"symfony/runtime": "7.0.*",
"symfony/twig-bundle": "7.0.*",
"symfony/uid": "7.0.*",
"symfony/yaml": "7.0.*",
"twig/twig": "^3.0"
},
"require-dev": {
"symfony/maker-bundle": "^1.58"
},
"config": {
"allow-plugins": {
"php-http/discovery": true,
"symfony/flex": true,
"symfony/runtime": true
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*",
"symfony/polyfill-php80": "*",
"symfony/polyfill-php81": "*",
"symfony/polyfill-php82": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"@auto-scripts"
],
"post-update-cmd": [
"@auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "7.0.*"
}
}
}