mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@61346 c90b9560-bf6c-de11-be94-00142212c4b1
242 lines
7.3 KiB
XML
242 lines
7.3 KiB
XML
<?xml encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.2 $ -->
|
|
<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>
|
|
$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:harald.radi@nme.at">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
|
|
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
|
|
-->
|