PHP and COM (轉)
can be used to access and DCOM s on platforms
1. I have built a DLL to calculate something. Is there any way to run this DLL under PHP ?
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.
2. What does 'Unsupported variant type: xxxx (0xxxxx)' mean ?
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 (if not already reported) and prov as much information as available.
3. Is it possible manipulate visual objects in PHP ?
Generally it is, but as PHP is mostly used as a 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.
4. Can I store a COM object in a session ?
No, you can't. COM instances are treated as res and therefore they are only available in a single script's context.
5. How can I trap COM errors ?
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.
6. Can I generate DLL files from PHP scripts like i can in ?
No, unfortunatelly there is no such tool available for PHP.
7. What does 'Unable to obtain IDispatch interface for CLSID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}' mean ?
This error can have multiple reasons:
-
the CLSID is wrong
-
the requested DLL is missing
-
the requested component doesn't implement the IDispatch interface
8. How can I run COM object from remote server ?
Exactly like you run local objects. You only have to pass the of the remote machine as second parameter to the COM constructor.
Make sure that you have set com.allow_dcom=true in your php.ini.
9. I get 'DCOM is disabled in C:path...scriptname.php on line 6', what can I do ?
Edit your php.ini and set com.allow_dcom=true.
10. Is it possible to load/manipulate an object in a page with PHP ?
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.
11. Is it possible to get a running instance of a component ?
This is possible with the help of monikers. If you want to get multiple references to the same instance you can create that instance like shown:
$word = new COM("C:docsword.doc");
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.
12. Is there a way to handle an event sent from COM object ?
Not yet.
13. I'm having problems when trying to invoke a method of a COM object wich exposes more than one interface. What can I do ?
The answer is as simple as unsatiying. I don't know exactly but i think you can do nothing. If someone has specific information about this, please let to:harald.radi@nme.at" target=_top>me know :)
14. So PHP works with COM, how about COM+ ?
COM+ extends COM by a for managing components through MTS and MSMQ but there is nothing special that PHP has to support to use such components.
15. If PHP can manipulate COM objects, can we imagine to use MTS to manage components resources, in conjunction with PHP ?
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.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/10752043/viewspace-992260/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Compiler.phpCompilePHP
- PHP遭棄用!Wordpress.com開源並轉用JavascriptPHPJavaScript
- PHP回顧之ComposerPHP
- PHP依賴管理ComposerPHP
- PHP Composer 簡明教程PHP
- 【PHP Composer】安裝&使用PHP
- [PHP Composer] 安裝&使用PHP
- PHP歷理 ICbA的database.php和common.phpPHPDatabase
- PHP 教程:Composer 最佳實踐PHP
- PHP之依賴管理composerPHP
- Oracle/PLSQL: UserEnv Function(轉自http://www.techonthenet.com/oracle/functions/userenv.php)OracleSQLFunctionHTTPPHP
- Code Complete (轉)
- PHP 之 Composer 新手入門指南PHP
- PHP Composer 的一個小坑PHP
- PHP composer 報錯 certificate verify failedPHPAI
- 用 Composer 組建了個 PHP 框架PHP框架
- docker-compose搭建php環境DockerPHP
- PHP Composer 以及PSR規範PHP
- Composer -- PHP依賴管理的用法PHP
- http://trans.godict.com/index.phpHTTPGoIndexPHP
- php-util - 整理了部分常用php方法, composer安裝PHP
- php4fun.sinaapp.com PHP挑戰通關攻略PHPAPP
- PHP安全配置(轉)PHP
- php.ini (轉)PHP
- PHP & Java(4) (轉)PHPJava
- PHP & Java(2) (轉)PHPJava
- PHP & Java(3) (轉)PHPJava
- PHP & Java(1) (轉)PHPJava
- PHP:路在何方? (轉)PHP
- PHP 迭代器 (轉)PHP
- PHP安全(2) (轉)PHP
- WordPress模板層次13:comments.phpPHP
- 利用 Composer 組建一個 PHP 框架PHP框架
- php-構建自己的composer包PHP
- 使用c# 開發 php的com元件C#PHP元件
- COM入門(轉載)
- COM 物件 和 介面 (轉)物件
- COM/DCOM的區別與聯絡 (轉)