PHP Fatal error: Class 'MongoClient' not found

Bug #1096587 reported by Dino
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
php-mongo (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

==== Sample code ====
<?php

$m = new MongoClient();

==== ERR MSG ====
PHP Fatal error: Class 'MongoClient' not found in sample.php

==== PHP Configuration ====
$ php --ini
Configuration File (php.ini) Path: /etc/php5/cli
Loaded Configuration File: /etc/php5/cli/php.ini
Scan for additional .ini files in: /etc/php5/cli/conf.d
Additional .ini files parsed: /etc/php5/cli/conf.d/10-pdo.ini,
/etc/php5/cli/conf.d/mongo.ini

$ php --info | grep mongo
/etc/php5/cli/conf.d/mongo.ini
mongo
mongo.allow_empty_keys => 0 => 0
mongo.allow_persistent => 1 => 1
mongo.chunk_size => 262144 => 262144
mongo.cmd => $ => $
mongo.default_host => localhost => localhost
mongo.default_port => 27017 => 27017
mongo.is_master_interval => 60 => 60
mongo.long_as_object => 0 => 0
mongo.native_long => 0 => 0
mongo.no_id => 0 => 0
mongo.ping_interval => 5 => 5
mongo.utf8 => 1 => 1

ProblemType: Bug
DistroRelease: Ubuntu 12.10
Package: php5-mongo 1.2.12-1
ProcVersionSignature: Ubuntu 3.5.0-21.32-generic 3.5.7.1
Uname: Linux 3.5.0-21-generic i686
ApportVersion: 2.6.1-0ubuntu9
Architecture: i386
Date: Sun Jan 6 21:10:37 2013
EcryptfsInUse: Yes
InstallationDate: Installed on 2013-01-06 (0 days ago)
InstallationMedia: Ubuntu 12.10 "Quantal Quetzal" - Release i386 (20121017.2)
MarkForUpload: True
SourcePackage: php-mongo
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
Dino (dinosu) wrote :
Dino (dinosu)
description: updated
Dino (dinosu)
Changed in php-mongo (Ubuntu):
status: New → Incomplete
status: Incomplete → New
Revision history for this message
Yun Liu1 (pick911) wrote :

Your driver version is too low: 1.2.12
The "MongoClient" starts from 1.3.0
Update your mongo driver with "pecl install mongo"

Revision history for this message
Dino (dinosu) wrote :

Yes, the problem can be solved by issue "sudo pecl install mongo" command. And perhaps that php5-mongo package should be upgraded to 1.3 base to close this bug. ;)

Revision history for this message
dcparham (dcparham) wrote :

I already had run "sudo pecl install mongo", and then got the php error, "Fatal error: Class 'MongoClient' not found in /var/www/info.php on line 7", line 7 being: "$m = new MongoClient(); //connect". When I try to try to sudo pecl install mongo it just says it is already installed and at 1.3.2!

So, what about having to complile mongo-php drivers, etc, stuff like that? How straight-forward/or not is it?

I [a]installed MongoDB and can insert records, find() them, etc, then I create a PHP page and try to connect to MongoDB - is it that simple? What else is needed? - please all of it in bullet form, not just "well you have to prepare all the dependencies" something like that - is there a set of steps that can be outlined, so that once MongoDB exists and works, then PHP can connect to it and display some of the records? Thanks!!

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in php-mongo (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.