Nauka html'u i php'
Rozdział 57. PHP and COM
PHP can be used to access COM and DCOM objects on Win32 platforms.
- 1. I have built a DLL to calculate something. Is there any way to run this DLL under PHP ?
- 2. What does 'Unsupported variant type: xxxx (0xxxxx)' mean ?
- 3. Is it possible manipulate visual objects in PHP ?
- 4. Can I store a COM object in a session ?
- 5. How can I trap COM errors ?
- 6. Can I generate DLL files from PHP scripts like i can in Perl ?
- 7. What does 'Unable to obtain IDispatch interface for CLSID {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}' mean ?
- 8. How can I run COM object from remote server ?
- 9. I get 'DCOM is disabled in C:\path...\scriptname.php on line 6', what can I do ?
- 10. Is it possible to load/manipulate an ActiveX object in a page with PHP ?
- 11. Is it possible to get a running instance of a component ?
- 12. Is there a way to handle an event sent from COM object ?
- 13. I'm having problems when trying to invoke a method of a COM object which exposes more than one interface. What can I do ?
- 14. So PHP works with COM, how about COM+ ?
- 15. If PHP can manipulate COM objects, can we imagine to use MTS to manage components resources, in conjunction with 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.
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.
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.
No, you can't. COM instances are treated as resources and therefore they are only available in a single script's context.
In PHP 5, the COM extension throws com_exception exceptions, which you can catch and then inspect the code member to determine what to do next.
In PHP 4 it's not possible to trap COM errors beside the ways provided by PHP itself (@, track_errors, ..).
No, unfortunately 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
Exactly like you run local objects. You only have to pass the IP 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.
Edit your php.ini and set
com.allow_dcom
=TRUE.
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.
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:
<?php |
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.
You can define an event sink and bind it using com_event_sink(). You can use com_print_typeinfo() to have PHP generate a skeleton for the event sink class.
13. I'm having problems when trying to invoke a method of a COM object which exposes more than one interface. What can I do ?
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 me know :)
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.
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 occurs no rollback is initiated. If you use components that support transactions you will have to implement the transaction management yourself.
| Poprzedni | Spis treści | Następny |
| PHP and HTML | Początek rozdziału | PHP i inne języki |
Lista dyskusyjna:
* 64-bitowy (x64) procesor o szybko¶ci 1 GHz,
* 1 GB pamiêci systemowe
* Dysk twardy o pojemno¶ci 40 GB i przynajmniej 15 GB wolnego miejsca
* Obs³uga grafiki DirectX 9 z:
- sterownikiem WDDM
- 128 MB pamiêci na karcie graficznej (minimum)
- sprzêtow± obs³ug± funkcji Pixel Shader 2.0
- obs³ug± 32-bitowej palety kolorów
zalecane wymagania Windows Vista posiadam:
AMD Athlon x2 x64 3600+ ( mo¿na by podkrêciæ )
GF7950GT 512mb
Geil 1GB DDr 2 PC800 ultra dual 512x512, dokupuje za tydzieñ 2GB tego samego ramu tez dual i ultra tylko 1024x1024 (3GB)
my¶lê, ¿e to stykanie na viste ale mam trzy pytania czy bêdzie du¿a ró¿nica miêdzy systemem 64 bit a 32? i gdzie ja zauwa¿ê w gra tez czy nie?
Czy je¶li ona wymaga np 128mb na karcie graficznej to czy przy w³±czeniu gry np zostanie mi tylko 384 bo vista zje 128
albo w przypadku procesora gdzie mam ledwo 2Ghz to vista zje 1 i dal gry zostanie 1?
Czy w grach bêdzie strasznie du¿a ró¿nica co do XP 32? ( chodzi mi o spadek wydajno¶ci )
jeszcze jedno znalaz³em na http://www.xp.net.pl/art/vista_opt.html optymalizacje visty czy to du¿o daje czy raczej nie op³aca siê w to bawiæ?
witajcie ponownie
ostatnio grzebie po sieci i znalaz³em co¶ co mnie zainteresowa³o.
Firma Dell ktorej przedstawiaæ nie trzeba u¿ywa w swoich XPS ( laptopach stworzonych dla graczy) karty typu
nVidia FX770M Graphics Card (with 512MB dedicated memory)
2 x 256MB nVidia GeForce 8700M GT SLI (Total 512MB)
Nvidia Quadro 2500M 512MB
wszystkie maja po 512 MB grafike ale która z tych jest lepsza i jaka jest ich wydajno¶æ w porównaniu do GF 8600 GS/GT czy GF 9500 GS GF 9600 GT ??
Mam problem, bo ¶ci±gn±³em pewien program w kilku czê¶ciach jako pliki .iso zapakowane w WinRarze. Domy¶lam siê, ¿e maj± one stworzyæ jeden plik instalacyjny. Pierwszy raz mam do czynienia z takimi plikami, czyta³em, ¿e u¿ywa siê programów do nagrywania p³yt ale nie wiem o co dok³adnie chodzi. U¿ywam programu Nero je¶li to pomo¿e. z góry dziêki za ka¿d± odpowied¼.
Czesc!
Pisze do Was z prosba o pomoc. Kupilem wczoraj nowy dysk do swojego kompa, jest to dysk Seagate SATA, chcialem by byl on dyskiem dodatkowym. Do tej pory mialem i mam dalej dysk Seagate ale ATA. System zostawilem bez zmian na starym dysku czyli na ATA. Przestawilem w BIOSIE obsluge ATA + SATA i niby wszystko dziala, system widzi oba dyski (mam Windowsa Xp SP2) ale za to przestal widziec napedy (DVD i CD-ROM). Dodam ze zadnych kabli od napedow nie odlaczalem. Mam wrazenie ze musze cos jeszcze zrobic w BIOSIE ale niestety nie wiem co i tutaj moja prosba o pomoc.
Posiadam kartê graficzna firmy PNY Geforce 9600 GT OC(http://pny.eu/products.php?section=product...p;productid=241). Podczas instalacji sterowników, pasek instalatora dochodzi do polowy, staje, po czym ekran robi siê czarny a w lewym górnym rogu miga kursor (znaczy taka kreseczka _ ).
Mój sprzêt:
PLYTA: ASUS P5Q
RAM: Geil 2Gb DDR2 1066
PROCESOR: INTEL CORE 2 QUAD 9550
ZASILACZ: CHIEFTEC 560W
Próbowa³em ju¿ 3 ró¿nych sterowników, nawet robi³em update biosa i dalej jest to samo