From fb7390ad0479f231a8d30aa9ff904da21627baee Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Thu, 27 Mar 2014 16:02:26 +0000 Subject: [PATCH] QA-495: Document context options for setting SSL. git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@333134 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mongo/mongoclient/construct.xml | 60 +++++++++++++++++++++-- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/reference/mongo/mongoclient/construct.xml b/reference/mongo/mongoclient/construct.xml index 1a9bedaf1a..b70ff3242b 100644 --- a/reference/mongo/mongoclient/construct.xml +++ b/reference/mongo/mongoclient/construct.xml @@ -13,6 +13,7 @@ public MongoClient::__construct stringserver"mongodb://localhost:27017" arrayoptionsarray("connect" => &true;) + arraydriver_options If no parameters are passed, this connects to "localhost:27017" (or whatever @@ -325,6 +326,32 @@ mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db + + + + driver_options + + + + An array of options for the MongoDB driver. Options include setting + connection context options for SSL or logging callbacks. + + + + "context" + + + A way to pass in context options. Context options allow you to + configure SSL certificates and are described at SSL context options. There is an example further + down that shows you how to use this. + + + + + + @@ -428,7 +455,7 @@ $m = new MongoClient("mongodb:///tmp/mongodb-27017.sock,localhost:27017"); A user must exist in the admin database before attempting to use authentication. You can create one with the Mongo shell by running: - + use admin switched to db admin @@ -485,7 +512,7 @@ $m = new MongoClient($uri, array('replicaSet' => 'rs')); Here we set the journal option to true and readPreference to secondary preferred as default for all write operations: - + And now we do the same, but as an options array: - + 'rs')); ?> +]]> + + + See the read preferences + section of this manual for further information. + + + + + <function>MongoClient::__construct</function> connecting with SSL + certifications example + + array( + 'local_cert' => '/vagrant/certs/client.pem', + 'cafile' => '/vagrant/certs/ca.pem', + ) +) ); + +$m = new MongoClient( + "mongodb://mongod/?ssl=true", + array(), + array('context' => $ctx) +); +?> ]]>