<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.com.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'en',
  ),
  'this' => 
  array (
    0 => 'com.construct.php',
    1 => 'com::__construct',
    2 => 'com class constructor',
  ),
  'up' => 
  array (
    0 => 'class.com.php',
    1 => 'com',
  ),
  'prev' => 
  array (
    0 => 'class.com.php',
    1 => 'com',
  ),
  'next' => 
  array (
    0 => 'class.dotnet.php',
    1 => 'dotnet',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/com/com/construct.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="com.construct" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">com::__construct</h1>
  <p class="verinfo">(PHP 4 &gt; 4.1.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">com::__construct</span> &mdash; <span class="dc-title">com class constructor</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-com.construct-description">
  <h3 class="title">Description</h3>
  <div class="constructorsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>com::__construct</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$module_name</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span> <code class="parameter">$server_name</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$codepage</code><span class="initializer"> = <strong><code><a href="com.constants.php#constant.cp-acp">CP_ACP</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$typelib</code><span class="initializer"> = &quot;&quot;</span></span><br>)</div>

  <p class="para rdfs-comment">
   Constructs a new com object.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-com.construct-parameters">
  <h3 class="title">Parameters</h3>
  <dl>
   
    <dt><code class="parameter">module_name</code></dt>
    <dd>
     <span class="simpara">
      Can be a ProgID, Class ID or Moniker that names the component to load.
     </span>
     <span class="simpara">
      A ProgID is typically the application or DLL name, followed by a period,
      followed by the object name. e.g: <code class="literal">Word.Application</code>.
     </span>
     <span class="simpara">
      A Class ID is the UUID that uniquely identifies a given class.
     </span>
     <span class="simpara">
      A Moniker is a special form of naming, similar in concept to a URL
      scheme, that identifies a resource and specifies how it should be
      loaded.  As an example, you could load up Word and get an object
      representing a word document by specifying the full path to the word
      document as the module name, or you can use <code class="literal">LDAP:</code> as
      a moniker to use the ADSI interface to LDAP.
     </span>
    </dd>
   
   
    <dt><code class="parameter">server_name</code></dt>
    <dd>
     <span class="simpara">
      The name of the DCOM server on which the component should be loaded and
      run.  If <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, the object is run using the default for the
      application.  The default is typically to run it on the local machine,
      although the administrator might have configured the application to
      launch on a different machine.
     </span>
     <span class="simpara">
      If a non-<strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> value is specified for server, PHP will refuse to load
      the object unless the <a href="com.configuration.php#ini.com.allow-dcom" class="link">com.allow_dcom</a> <var class="filename">php.ini</var> option
      is set to <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>.
     </span>
     <p class="para">
      If <code class="parameter">server_name</code> is an array, it should contain the
      following elements (case sensitive!).  Note that they are all optional
      (although you need to specify both Username and Password together); if
      you omit the Server setting, the default server will be used (as
      mentioned above), and the instantiation of the object will not be
      affected by the <a href="com.configuration.php#ini.com.allow-dcom" class="link">com.allow_dcom</a>
      <var class="filename">php.ini</var> directive.
      <table class="doctable table">
       <caption><strong>DCOM server name</strong></caption>
       
        <thead>
         <tr>
          <th>key</th>
          <th>type</th>
          <th>description</th>
         </tr>

        </thead>

        <tbody class="tbody">
         <tr>
          <td>Server</td>
          <td>string</td>
          <td>The name of the server.</td>
         </tr>

         <tr>
          <td>Username</td>
          <td>string</td>
          <td>The username to connect as.</td>
         </tr>

         <tr>
          <td>Password</td>
          <td>string</td>
          <td>The password for <code class="literal">Username</code>.</td>
         </tr>

         <tr>
          <td>Domain</td>
          <td>string</td>
          <td>The domain of <code class="literal">server</code>.</td>
         </tr>

         <tr>
          <td>Flags</td>
          <td>integer</td>
          <td>One or more of the following constants, logically OR&#039;d together:
           <strong><code><a href="com.constants.php#constant.clsctx-inproc-server">CLSCTX_INPROC_SERVER</a></code></strong>,
           <strong><code><a href="com.constants.php#constant.clsctx-inproc-handler">CLSCTX_INPROC_HANDLER</a></code></strong>,
           <strong><code><a href="com.constants.php#constant.clsctx-local-server">CLSCTX_LOCAL_SERVER</a></code></strong>,
           <strong><code><a href="com.constants.php#constant.clsctx-remote-server">CLSCTX_REMOTE_SERVER</a></code></strong>,
           <strong><code><a href="com.constants.php#constant.clsctx-server">CLSCTX_SERVER</a></code></strong> and
           <strong><code><a href="com.constants.php#constant.clsctx-all">CLSCTX_ALL</a></code></strong>.  The default value if not
           specified here is <strong><code><a href="com.constants.php#constant.clsctx-server">CLSCTX_SERVER</a></code></strong> if you also
           omit <code class="literal">Server</code>, or
           <strong><code><a href="com.constants.php#constant.clsctx-remote-server">CLSCTX_REMOTE_SERVER</a></code></strong> if you do specify a
           server.  You should consult the Microsoft documentation for
           CoCreateInstance for more information on the meaning of these
           constants; you will typically never have to use them.
          </td>
         </tr>

        </tbody>
       
      </table>

     </p>
    </dd>
   
   
    <dt><code class="parameter">codepage</code></dt>
    <dd>
     <span class="simpara">
      Specifies the codepage that is used to convert strings to
      unicode-strings and vice versa.  The conversion is applied whenever a
      PHP string is passed as a parameter or returned from a method of this
      COM object.  The code page is sticky, which means that it will
      propagate to objects and variants returned from the object.
     </span>
     <span class="simpara">
      Possible values are
      <strong><code><a href="com.constants.php#constant.cp-acp">CP_ACP</a></code></strong> (use system default ANSI code page - the
      default if this parameter is omitted),
      <strong><code><a href="com.constants.php#constant.cp-maccp">CP_MACCP</a></code></strong>,
      <strong><code><a href="com.constants.php#constant.cp-oemcp">CP_OEMCP</a></code></strong>, <strong><code><a href="com.constants.php#constant.cp-symbol">CP_SYMBOL</a></code></strong>,
      <strong><code><a href="com.constants.php#constant.cp-thread-acp">CP_THREAD_ACP</a></code></strong> (use codepage/locale set for the
      current executing thread), <strong><code><a href="com.constants.php#constant.cp-utf7">CP_UTF7</a></code></strong>
      and <strong><code><a href="com.constants.php#constant.cp-utf8">CP_UTF8</a></code></strong>.  You may also use the number for a
      given codepage; consult the Microsoft documentation for more details on
      codepages and their numeric values.
     </span>
    </dd>
   
  </dl>
 </div>


</div><?php manual_footer($setup); ?>