mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 08:05:53 +03:00
[GH-ISSUE #962] Monolog MongoDBClient Error for php >7.0 #387
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#387
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jeicken on GitHub (Mar 30, 2017).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/962
Hello!
I am having an issue with using the Monolog MongoDB functionality with php 7.0.15.
The \Monolog\Handler\MongoDBHandler.php expects a MongoDB\Client which has been removed in php 7.0.15. This renders the Monolog MongoDB functionality unusable at the moment for php7, or am I missing something?
Best regards
Jan Eicken
@moderndeveloperllc commented on GitHub (Mar 30, 2017):
@jeicken This has more to do with which MongoDB extension you are using for PHP.
MongoDB\Clientis part of the newmongodbextension and is what themasterbranch is coded to. If you are using the oldmongoextension, you really should look into upgrading if possible or stick to monolog 1.x versions as that code checks for classes from both extensions.@jeicken commented on GitHub (Apr 3, 2017):
@moderndeveloperllc thank you for your answer.
I installed the newest PECL package on my server, the class MongoDB\Client can still not be found (I checked if the reference for the extension is correct in the php.ini).
It also states in the docs here, that there is neither a class MongoDB\Client nor \MongoClient available in the newest php mongodb extension.
I am using laravel 5.4 which is shipped with monolog 1.22.1 as far as I can see.
Any poking in the right direction is highly appreciated :)
@stof commented on GitHub (Apr 3, 2017):
@jeicken the new mongodb integration for PHP is split in 2 parts:
mongodbPECL extension for the low-level drivermongodb/mongodbcomposer package for the higher level API.MongoDB\Clientis part of the userland library, not of the C extension (they moved as many features as possible to the userland library as a PHP library is easier to maintain, to evolve and to receive contributions that a C extension, given that most PHP developers don't know C).So you need to install that package to use the new MongoDBHandler, not only the C extension.
@jeicken commented on GitHub (Apr 3, 2017):
@stof Thanks pointing that out, tried with your supposed solution and all worked fine.
Would have been pretty nice to have that documented clearly somewhere. But maybe I am just too blind to see it ;)
Either way, this issue can be closed, thanks for the quick help guys!
@stof commented on GitHub (Apr 3, 2017):
@jeicken the composer.json already suggests installing
mongodb/mongodbto use the MongoDB handler.