Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The easiest way on the command line is by invoking reflection info:</p> <pre><code>$ php --ri mongo | grep Version </code></pre> <p>will output for example:</p> <pre><code>Version =&gt; 1.4.4 </code></pre> <p>This will run <a href="http://php.net/reflectionextension.info">ReflectionExtension::info()</a> on the mongo extension, and grep the Version column.</p> <p>Couple of other alternatives would be to execute some code, and print out the version information.</p> <p>The <a href="http://php.net/mongoclient">MongoClient</a> class (and the Mongo class for old extensions) as a <a href="http://php.net/class.mongoclient#mongoclient.constants.version">VERSION</a> constant:</p> <pre><code>$ php -r 'echo MongoClient::VERSION, "\n";' </code></pre> <p>will output (for example):</p> <pre><code>1.4.4 </code></pre> <p>Or you could use the <a href="http://php.net/phpversion">phpversion</a> function to retrieve the version number from the module initialization:</p> <pre><code>$ php -r 'echo phpversion("mongo"), "\n";' </code></pre> <p>will output (for example):</p> <pre><code>1.4.4 </code></pre> <hr> <p>EDIT:</p> <p>The above refers to the now-old and legacy <a href="https://pecl.php.net/package/mongo">pecl/mongo</a> extension. There is a new extension called <a href="https://pecl.php.net/package/mongodb">pecl/mongodb</a>.</p> <p>Similar commands work for the new extension:</p> <pre><code>$ php --ri mongodb | grep version mongodb version =&gt; 1.1.2 libmongoc version =&gt; 1.3.1-dev libbson version =&gt; 1.3.0 $ php -r 'echo MONGODB_VERSION, "\n";' 1.2.2 $ php -r 'echo phpversion("mongodb"), "\n";' 1.2.2 $ php -dmongodb.debug=stdout -r 'new MongoDB\Driver\Manager;' | grep Creating [2016-03-01T17:59:23+00:00] PHONGO: DEBUG &gt; Creating Manager, phongo-1.1.2[stable] - mongoc-1.3.1-dev(bundled), libbson-1.3.0(bundled), php-5.6.16 </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload