I'm having some difficulty configuring PHP to integrate with MongoDB on my Mac.
I can confirm that PHP is running correctly, and the php.ini file I am tinkering with is the correct one (I can see phpinfo() results change accordingly).
I also have MongoDB running properly, from the command line and via a Node.js application.
I have installed PEAR, and have attempted to install the Mongo library via:
$ sudo pecl install mongodb
But this apparently fails with:
configure: error: Cannot find OpenSSL's <evp.h>
ERROR: `/private/tmp/pear/install/mongodb/configure --with-php-config=/usr/bin/php-config' failed
I guess this is why I can't find mongo.so or mongodb.so anywhere on my system, and why adding either of the following lines to my php.ini does absolutely nothing:
extension=mongodb.so
extension=mongo.so
This whole thing manifests itself in the browser as:
Fatal error: Class 'Mongo' not found in /private/var/www/path/to/MyFile.php on line 8
And the code for MyFile.php is as follows:
<?php
// DEBUGGING
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
try {
$m = new Mongo();
$db = $m->selectDB("records");
}
catch (MongoConnectionException $e){
echo '<p>Couldn\'t connect to mongodb, is the "mongo" process running?</p>';
exit();
}
?>