PHP can operate COM and DCOM objects on Win32 platform 1. I created a DLL to calculate something. Is there any way to run this DLL in PHP? 2. 'Unsupported variant type: xxxx (0xxxxx)' What does it mean? 3. Is it possible to operate visual objects in PHP? 4. Can I save COM objects in session? 5. How do I catch COM errors? 6. How do I generate DLL files in PHP, just like I did in Perl? 7. 'Unable to obtain IDispatch interface for CLSID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxxxxxxxxxxxx}' What does ? 8. How do I run a COM object from a remote server? 9. I get the message: 'DCOM is disabled in C:\path...\ on line 6', what should I do? 10. Can I load an ActiveX object in PHP page? 11. Can I get an instance of COM runtime? 12. Is there a way to handle events sent from a COM object? 13. Is there an error when calling a method of a COM object (with multiple interfaces), . What should I do? 14. PHP can work with COM, so what about COM+? 15. PHP can operate COM objects, can we imagine managing component resources through MTS, thereby managing PHP?
1. I created a DLL to calculate something. Is there any way to run this DLL in PHP?
You cannot operate simple DLLs in PHP. If this DLL contains a COM server and implements the IDispatch interface, you can operate it.
2. What does 'Unsupported variant type: xxxx (0xxxxx)' mean?
There are many VARIANT types and their collections. Most have been supported, but there are still a few that do not. Arrays are not fully supported, only one-dimensional arrays are supported. If you still find unsupported data types: please send a bug report (if there is no report yet) and provide as much information as possible.
3. Is it possible to operate visual objects in PHP?
Usually ok. However, PHP is mostly used to run as a script on a web server device, and visual objects never appear on the server desktop. If you use PHP as an application script such as PHP-GTK, then there is no limit to visualizing objects through COM operation.
4. Can I save the COM object in the session?
Can't. COM instances are considered as resources. Therefore they can only work in a single scripting program.
5. How do I catch COM errors?
There are currently no other tools that can track COM errors, except for PHP itself (@, track_errors, ..), we are considering a way to implement it.
6. Can I generate DLL files in PHP, just like I did in Perl?
Can't. Unfortunately there is no such PHP tool.
7. 'Unable to obtain IDispatch interface for CLSID {xxxxxxx-xxxx-xxxx-xxxx-xxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx}' What does it mean?
There are many reasons for this error:
The CLSID number is wrong
The DLL where COM is not found
The component does not implement the IDispatch interface
8. How do I run a COM object from a remote server?
Just like you run a local object. You just need to pass the remote IP address as a second parameter to the COM constructor.
Also confirm com.allow_dcom=true in your file.
9. I get the message: 'DCOM is disabled in C:\path...\ on line 6', what should I do?
Edit file, set com.allow_dcom=true.
10. Can ActiveX objects be loaded in PHP page?
This should have nothing to do with PHP. ActiveX is a client object called by an HTML page. It has no direct relationship with PHP scripts. Of course, there is no possibility of direct server interaction.
11. Can you get an instance of COM runtime? ?
This function can be implemented using monkers. If you want to get multiple references to the same Word instance, you can use the following code: that instance like show: $word = new COM("C:\docs\");
If no instance of Word is running, it creates a new instance. Otherwise, it returns its handle.
12. Is there a way to handle events sent from COM objects?
Not yet.
13. I'm having an error calling a method of a COM object (with multiple interfaces), . What should I do?
The answer is so simple that it's not satisfying. I'm not very clear, but I don't think you have to do anything. If anyone has some situations and opinions about this, please let me (@) know :)
14. PHP can work with COM, so what about COM+?
COM+ extends the COM framework to manage components through MTS and MSMQ. There is nothing special about PHP not supported.
15. PHP can operate COM objects. Can we imagine managing component resources through MTS to manage PHP?
PHP itself cannot process transactions. That is to say, if an error occurs, it will not roll back actively. Even if you use component objects that support transactions, you still have to implement transaction management by yourself. (Transactions - transactions)