| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 164
 165
 166
 167
 168
 169
 170
 171
 172
 173
 174
 175
 176
 177
 178
 179
 180
 181
 182
 183
 184
 185
 186
 187
 188
 189
 190
 191
 192
 193
 194
 195
 196
 197
 198
 199
 200
 201
 202
 203
 204
 205
 206
 207
 208
 209
 210
 211
 212
 213
 214
 215
 216
 217
 218
 219
 220
 221
 222
 223
 224
 225
 226
 227
 228
 229
 230
 231
 232
 233
 234
 235
 236
 237
 238
 239
 240
 241
 242
 243
 
 | <?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
 <chapter id="faq.com">
  <title>PHP and COM</title>
  <titleabbrev>PHP and COM</titleabbrev>
   <para>
    PHP can be used to access COM and DCOM objects on Win32 platforms.
   </para>
  <qandaset>
   <qandaentry id="faq.com.q1">
    <question>
     <para>I have built a DLL to calculate something. Is there any way to run this DLL under PHP ?</para>
    </question>
    <answer>
     <para>
      If this is a simple DLL there is no way yet to run it from PHP. If the DLL contains a COM
      server you may be able to access it if it implements the IDispatch interface.
     </para>
    </answer>
   </qandaentry>
   
   <qandaentry id="faq.com.q2">
    <question>
     <para>What does 'Unsupported variant type: xxxx (0xxxxx)' mean ?</para>
    </question>
    <answer>
     <para>
      There are dozens of VARIANT types and combinations of them. Most of them are already supported but
      a few still have to be implemented.
      Arrays are not completely supported. Only single dimensional indexed
      only arrays can be passed between PHP and COM.
      If you find other types that aren't supported, please report them as a bug (if not already reported)
      and provide as much information as available.
     </para>
    </answer>
   </qandaentry>
  
   <qandaentry id="faq.com.q3">
    <question>
     <para>Is it possible manipulate visual objects in PHP ?</para>
    </question>
    <answer>
     <para>
      Generally it is, but as PHP is mostly used as a web scripting language it runs in the web servers context, thus
      visual objects will never appear on the servers desktop.
      If you use PHP for application scripting e.g. in conjunction with PHP-GTK there is no limitation in accessing and
      manipulating visual objects through COM.
     </para>
    </answer>
   </qandaentry>
  
   <qandaentry id="faq.com.q4">
    <question>
     <para>Can I store a COM object in a session ?</para>
    </question>
    <answer>
     <para>
      No, you can't. COM instances are treated as resources and therefore they are only available in a single script's context.
     </para>
    </answer>
   </qandaentry>
  
   <qandaentry id="faq.com.q5">
    <question>
     <para>How can I trap COM errors ?</para>
    </question>
    <answer>
     <para>
      Currently it's not possible to trap COM errors beside the ways provided by PHP itself (@, track_errors, ..), but we are
      thinking of a way to implement this.
     </para>
    </answer>
   </qandaentry>
  
   <qandaentry id="faq.com.q6">
    <question>
     <para>Can I generate DLL files from PHP scripts like i can in Perl ?</para>
    </question>
    <answer>
     <para>
      No, unfortunatelly there is no such tool available for PHP.
     </para>
    </answer>
   </qandaentry>
  
   <qandaentry id="faq.com.q7">
    <question>
     <para>What does 'Unable to obtain IDispatch interface for CLSID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}' mean ?</para>
    </question>
    <answer>
     <para>
      This error can have multiple reasons:
      <itemizedlist>
       <listitem>
 	    <simpara>
         the CLSID is wrong
 	    </simpara>
 	   </listitem>
       <listitem>
 	    <simpara>
         the requested DLL is missing
 	    </simpara>
 	   </listitem>
       <listitem>
 	    <simpara>
         the requested component doesn't implement the IDispatch interface
 	    </simpara>
 	   </listitem>
 	  </itemizedlist>
     </para>
    </answer>
   </qandaentry>
    
   <qandaentry id="faq.com.q8">
    <question>
     <para>How can I run COM object from remote server ?</para>
    </question>
    <answer>
     <para>
      Exactly like you run local objects. You only have to pass the ip of the remote machine as second parameter to
      the COM constructor.
     </para>
     <para>
      Make sure that you have set <literal>com.allow_dcom=true</literal> in your <literal>php.ini</literal>.
     </para>
    </answer>
   </qandaentry>
   
   <qandaentry id="faq.com.q9">
    <question>
     <para>I get 'DCOM is disabled in C:\path...\scriptname.php on line 6', what can I do ?</para>
    </question>
    <answer>
     <para>
      Edit your <literal>php.ini</literal> and set <literal>com.allow_dcom=true</literal>.
     </para>
    </answer>
   </qandaentry>
   
   <qandaentry id="faq.com.q10">
    <question>
     <para>Is it possible to load/manipulate an ActiveX object in a page with PHP ?</para>
    </question>
    <answer>
     <para>
      This has nothing to do with PHP. ActiveX objects are loaded on client side if they are requested
      by the HTML document. There is no relation to the PHP script and therefore there is no direct
      server side interaction possible.
     </para>
    </answer>
   </qandaentry>
   
   <qandaentry id="faq.com.q11">
    <question>
     <para>Is it possible to get a running instance of a component ?</para>
    </question>
    <answer>
     <para>
      This is possible with the help of monikers. If you want to get multiple references to the same word instance
      you can create that instance like shown:
     </para>
     <programlisting role="php">
      $word = new COM("C:\docs\word.doc");
     </programlisting>
     <para>
      This will create a new instance if there is no running instance available or it will return a handle to the
      running instance, if available.
     </para>
    </answer>
   </qandaentry>
   
   <qandaentry id="faq.com.q12">
    <question>
     <para>Is there a way to handle an event sent from COM object ?</para>
    </question>
    <answer>
     <para>
      Not yet.
     </para>
    </answer>
   </qandaentry>
   
   <qandaentry id="faq.com.q13">
    <question>
     <para>I'm having problems when trying to invoke a method of a COM object wich exposes more than one interface. What can I do ?</para>
    </question>
    <answer>
     <para>
      The answer is as simple as unsatisfying. I don't know exactly but i think you can do nothing.
      If someone has specific information about this, please let <ulink url="mailto:&email.harald;">me</ulink> know :)
     </para>
    </answer>
   </qandaentry>
   
   <qandaentry id="faq.com.q14">
    <question>
     <para>So PHP works with COM, how about COM+ ?</para>
    </question>
    <answer>
     <para>
      COM+ extends COM by a framework for managing components through MTS and MSMQ but there is nothing special that
      PHP has to support to use such components.
     </para>
    </answer>
   </qandaentry>
   
   <qandaentry id="faq.com.q15">
    <question>
     <para>If PHP can manipulate COM objects, can we imagine to use MTS to manage components resources, in conjunction with PHP ?</para>
    </question>
    <answer>
     <para>
      PHP itself doesn't handle transactions yet. Thus if an error occours no rollback is initiated. If you use components that
      support transactions you will have to implement the transaction management yourself.
     </para>
    </answer>
   </qandaentry>
 
  </qandaset>
 </chapter>
<!-- 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:"../../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
-->
 |