<?xml version="1.0" encoding="utf-8"?>

<!-- $Revision: 330655 $ -->
<phpdoc:classref xml:id="class.mongoconnectionexception" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">

 <title>The MongoConnectionException class</title>
 <titleabbrev>MongoConnectionException</titleabbrev>

 <partintro>

  <!-- {{{ Mongoconnectionexception intro -->
  <section xml:id="mongoconnectionexception.intro">
   &reftitle.intro;
   <para>
    Thrown when the driver fails to connect to the database.
   </para>

   <para>
    There are a number of possible error messages to help you diagnose the 
    connection problem.  These are:
   </para>

   <itemizedlist>
    <listitem>
     <para>
      <literal>No candidate servers found</literal>
     </para>
     <para>
     Thrown when the driver cannot establish a connection to MongoDB
     (fulfilling the ReadPreferences, if specified).
     </para>
    </listitem>

    <listitem>
     <para>
      <literal>No server name given.</literal>
     </para>
     <para>
      This error occurs if you pass in "" as the server name, 
      probably because of an typo with string interpolation, 
      e.g., "$servr" instead of "$server".
     </para>
    </listitem>
    <listitem>
     <para>
      <literal>
       failed to get host [hostname] or port [portnum] 
       from [server].
      </literal>
     </para>
     <para>
       This indicated that the server string was malformed.  
       "[hostname]" and "[portnum]" will be as much as the 
       driver could dicipher of it.
     </para>
    </listitem>
    <listitem>
     <para>
      <literal>Operation in progress</literal>
     </para>
     <para>
      Connecting to the database timed out.
     </para>
    </listitem>
    <listitem>
     <para>
      <literal>Transport endpoint is not connected</literal>
     </para>
     <para>
      Generally means that the connection string isn't correct, the driver
      couldn't even find the database server.
     </para>
    </listitem>
    <listitem>
     <para>
      <literal>couldn't determine master</literal>
     </para>
     <para>
      No server in a replica set connection was identified as the primary.
     </para>
    </listitem>
    <listitem>
     <para>
      <literal>couldn't get host info for [server]</literal>
     </para>
     <para>
      This indicated that DNS could not resolve the server address 
      you gave.  This could easily be caused by a typo, for example, 
      "server" instead of "$server".
     </para>
    </listitem>
    <listitem>
     <para>
      <literal>Invalid Argument</literal>
     </para>
     <para>
      This can be caused by attempting to connect to a machine that is up but
      that the database isn't actually running on.  Make sure that you've
      started the database server before connecting.      
     </para>
    </listitem>
    <listitem>
     <para>
      <literal>Permission denied</literal>
     </para>
     <para>
      This means that the socket could not be opened due to permissions issues.
      On Red Hat variants, this can be caused by a default setting that does not
      allow Apache to create network connections.  You can override this setting
      by running:
      <programlisting>
<![CDATA[
$ /usr/sbin/setsebool -P httpd_can_network_connect 1
]]>
      </programlisting>
      then restarting Apache.
     </para>
    </listitem>
   </itemizedlist>

   <para>  
    If the error message is not listed above, it is probably an error 
    from the C socket, and you can search the web for its usual cause.
   </para>
  </section>
  <!-- }}} -->

  <section xml:id="mongoconnectionexception.synopsis">
   &reftitle.classsynopsis;

   <!-- {{{ Synopsis -->
   <classsynopsis>
    <ooclass><classname>MongoConnectionException</classname></ooclass>

    <!-- {{{ Class synopsis -->
    <classsynopsisinfo>
     <ooclass>
      <classname>MongoConnectionException</classname>
     </ooclass>
     <ooclass>
      <modifier>extends</modifier>
      <classname>MongoException</classname>
     </ooclass>
    </classsynopsisinfo>
    <!-- }}} -->
    
   </classsynopsis>
   <!-- }}} -->

  </section>

 </partintro>

</phpdoc:classref>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
