pecl/mongo requires PHP (version >= 5.3.0, version <= 5.99.99), installed version is 7.0.4-7ubuntu2.1 No valid packages found install failed
Asked Answered
C

2

9

I would to connect lampp to mongodb so I need to install mongodb client , I do sudo pecl install mongo il m'affiche le message suivant :

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/mongo.so' - /usr/lib/php/20151012/mongo.so: undefined symbol: zval_used_for_init in Unknown on line 0 PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php/20151012/php_mongo.dll' - /usr/lib/php/20151012/php_mongo.dll: cannot open shared object file: No such file or directory in Unknown on line 0 WARNING: "pecl/mongo" is deprecated in favor of "channel:///mongodb" pecl/mongo requires PHP (version >= 5.3.0, version <= 5.99.99), installed version is 7.0.4-7ubuntu2.1 No valid packages found install failed, please how to correct this error

Cusec answered 26/6, 2016 at 7:12 Comment(0)
K
16

mongo is the old driver which is not compatible with PHP 7, you need to use new driver mongodb.

Kellene answered 26/6, 2016 at 14:3 Comment(6)
Thinks, can you tell me how I use the new driver mongodbCusec
Thinks I do under the folder /opt/lampp/bin : sudo pecl install mongodb, and it works :)Cusec
Now, I try to test connection xampp with database mongodb, so I create a file sample.php which contains this code : <?php echo "<h2>Connection to database successfully</h2>"; $m=new MongoClient(); echo "<h2>Connection to database successfully</h2>"; $db=$m -> loginproject; echo "<h2>database $db successfully</h2>"; ?>Cusec
when I run localhost/sample.php I find this error: Fatal error: Class 'MongoClient' not found in /opt/lampp/htdocs/sample.php on line 3; please help me to correct this errorCusec
Have you read the docs I linked? MongoClient is from OLD driver and it's not available in new oneKellene
Example of usage pecl install -f mongodb-stable from github.com/FriendsOfSymfony/FOSOAuthServerBundle/blob/master/…Moth
A
3

It's easy all you have to do is change it to sudo pecl install mongodb

Affricate answered 6/6, 2020 at 4:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.