Undefined constant MongoDB\Driver\ReadPreference::RP_PRIMARY
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 341
- PR merge metrics
- No merged PRs in 30d
Description
Hello,
Tried to use xhgui with docker, used the provided docker-compose.yml, and the issue still exists from #567
docker logs docker_xhgui_1
[25-Sep-2025 23:30:09] NOTICE: fpm is running, pid 1
[25-Sep-2025 23:30:09] NOTICE: ready to handle connections
172.20.0.2 - 25/Sep/2025:23:30:24 +0000 "GET /index.php" 500
[25-Sep-2025 23:30:24] WARNING: [pool www] child 26 said into stderr: "NOTICE: PHP message: Slim Application Error:"
[25-Sep-2025 23:30:24] WARNING: [pool www] child 26 said into stderr: "Type: Error"
[25-Sep-2025 23:30:24] WARNING: [pool www] child 26 said into stderr: "Message: Undefined constant MongoDB\Driver\ReadPreference::RP_PRIMARY"
[25-Sep-2025 23:30:24] WARNING: [pool www] child 26 said into stderr: "File: /var/www/xhgui/vendor/alcaeus/mongo-php-adapter/lib/Alcaeus/MongoDbAdapter/Helper/ReadPreference.php"
[25-Sep-2025 23:30:24] WARNING: [pool www] child 26 said into stderr: "Line: 41"
[25-Sep-2025 23:30:24] WARNING: [pool www] child 26 said into stderr: "Trace: #0 /var/www/xhgui/vendor/alcaeus/mongo-php-adapter/lib/Mongo/MongoDB.php(69): MongoClient->getReadPreference()"
[25-Sep-2025 23:30:24] WARNING: [pool www] child 26 said into stderr: "#1 /var/www/xhgui/vendor/alcaeus/mongo-php-adapter/lib/Mongo/MongoClient.php(304): MongoDB->__construct()"
[25-Sep-2025 23:30:24] WARNING: [pool www] child 26 said into stderr: "#2 /var/www/xhgui/src/ServiceProvider/MongoStorageProvider.php(31): MongoClient->selectDB()"
[25-Sep-2025 23:30:24] WARNING: [pool www] child 26 said into stderr: "#3 /var/www/xhgui/vendor/pimple/pimple/src/Pimple/Container.php(122): XHGui\ServiceProvider\MongoStorageProvider::XHGui\ServiceProvider\{closure}()"
[25-Sep-2025 23:30:24] WARNING: [pool www] child 26 said into stderr: "#4 /var/www/xhgui/src/ServiceProvider/MongoStorageProvider.php(51): Pimple\Container->offsetGet()"
[25-Sep-2025 23:30:24] WARNING: [pool www] child 26 said into stderr: "#5 /var/www/xhgui/vendor/pimple/pimple/src/Pimple/Container.php(122): XHGui\ServiceProvider\MongoStorageProvider::XHGui\ServiceProvider\{closure}()"
[25-Sep-2025 23:30:24] WARNING: [pool www] child 26 said into stderr: "#6 /var/www/xhgui/src/ServiceProvider/ServiceProvider.php(31): Pimp..."
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the provided docker-compose.yml and reproduce the 500 error, then trace the failure from src/ServiceProvider/MongoStorageProvider.php into vendor/alcaeus/mongo-php-adapter/lib/Alcaeus/MongoDbAdapter/Helper/ReadPreference.php at line 41. Check the MongoDB driver compatibility involved; done means the Docker setup starts successfully and the application loads without the undefined-constant error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, mongodb, php
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100