I am using Ubuntu 12.04, PHP 5.5.13 (cli) and Apache/2.4.10. I installed Mongodb 2.6.4. It's working fine. Then i installed PHP-MongoDB driver. It got installed but is not showing in phpinfo(). When i execute php file with mongodb, i get the following error:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20121212/mongo.so' - /usr/lib/php5/20121212/mongo.so: cannot open shared object file: No such file or directory in Unknown on line 0
[Sun Aug 24 11:48:39.403845 2014] [:error] [pid 3008] [client 127.0.0.1:58857] PHP Fatal error: Class 'MongoClient' not found in /var/www/PHP/php-mongo/testingmongodb.php on line 3, referer: http://localhost/PHP/php-mongo/
I installed PHP Mongodb driver as follows:
sudo pecl install mongo
There are two php.ini so i added
extension=mongo.so
in both php.ini
/etc/php.ini
/etc/php5/apache2/php.ini
Then, restarted apache2
I also tried manual way.
unzip php_mongo-1.5.1.zip
cd mongodb-php-driver
phpize
./configure
sudo make install
While excuting phpize, i got the following error:
Cannot find config.m4.
Make sure that you run '/usr/bin/phpize' in the top level source directory of the module
I also create a file /etc/php5/conf.d/mongo.ini and added "extension=mongo.so" but, still nothing is happening. I can't figure it out what's happening. Please help me in this.
pecl? In your first log messages it looks like themongo.soextension wasn't installed in the expected directory ("/usr/lib/php5/20121212/"). When you tried the manual way, it seems like you're missing the PHP source. Have you triedsudo apt-get install php5-dev php5-cli php-pearbefore installing (as per the MongoDB manual). - Stennie