I have a site using Apache that is just the following code:
<?php $m = new MongoClient(); ?>
and when I try to access it, I get the error in error.log
`PHP Fatal Error: Class 'MongoClient' not found`
The following are settings which might be wrong, but I don't think are.
php -i | grep 'Configuration'
=> Configuration File (php.ini) Path => /etc/php5/cli | Loaded Configuration File => /etc/php5/cli/php.ini
grep 'mongo' /etc/php5/cli/php.ini
=> extension=mongo.so
php -i | grep 'extension'
=>
extension_dir => /usr/lib/php5/20121212 => /usr/lib/php5/20121212
ls /usr/lib/php5/20121212/ | grep 'mongo.so'
=> mongo.so
I haven't been able to find anything to suggest I installed it wrong or have it wrongly configured. I installed it within the past two hours using pecl
and pear
(sudo pear install -f pecl/mongo
and sudo pecl install mongo
)
I've restarted my Apache and even my computer multiple times.
So why am I getting the error Class 'MongoClient' not found
?
I'm on Ubuntu. PHP version 5.5.
Edit: I've just discovered that MongoClient is valid when I run php in interactive mode. Perhaps it has to do with a user permission/user installation issue?