I tried this code below, but not working - No Output Showing
<?php
$manager = new MongoDB\Driver\Manager("mongodb://localhost:27017");
var_dump($manager);
?>
Also tried another code shown below, but this also produces no output
<?php
// connect to mongodb
$m = new MongoClient();
echo "Connection to database successfully";
// select a database
$db = $m->mydb;
echo "Database mydb selected";
?>
What am i doing wrong?
$ mongod --version db version v3.4.4 git version: 888390515874a9debd1b6c5d36559ca86b44babd OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014 allocator: tcmalloc modules: none build environment: distmod: ubuntu1404 distarch: x86_64 target_arch: x86_64
**
$ php --version PHP 5.6.30-12~ubuntu14.04.1+deb.sury.org+1 (cli) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
**
$ php -i | grep extension_dir extension_dir => /usr/lib/php/20131226 => /usr/lib/php/20131226 $ cd /usr/lib/php/20131226 $ ls calendar.so exif.so gettext.so mbstring.so pdo.so readline.so sockets.so sysvshm.so xmlreader.so xsl.so ctype.so fileinfo.so iconv.so mongodb.so phar.so shmop.so sysvmsg.so tokenizer.so xml.so dom.so ftp.so json.so opcache.so posix.so simplexml.so sysvsem.so wddx.so xmlwriter.so
**
echo extension_loaded("mongo") ? "loaded\n" : "not loaded\n";
produces output - not loaded
php.ini