DCOM in PHP
Moderator: General Moderators
-
psmshankar
- Forum Commoner
- Posts: 96
- Joined: Tue Aug 06, 2002 4:25 am
- Location: India
DCOM in PHP
Hi all,
I am using PHP 4.0 running under Apache on Win'98 box.
I have created a COM object and has to instantiate this and make use of this COM object from another machine also running PHP 4.0/win'98.
the syntax i used is:
$objDevice = new COM("SMSServer.clsDevice","10.100.120.67")or die("Unable to instantiate");
but it always shows unable to instantiate??
I have registered the COM object in the server 10.100.120.67
so from server A i am instantiating a COM object in server B(10.100.120.67)
Where i am wrong...from the local machine i am able to do..that is just COM...but when i used DCOM it says unable to instantiate??
Am i missing out anything
pls help me out.
Thanks
Shankar
I am using PHP 4.0 running under Apache on Win'98 box.
I have created a COM object and has to instantiate this and make use of this COM object from another machine also running PHP 4.0/win'98.
the syntax i used is:
$objDevice = new COM("SMSServer.clsDevice","10.100.120.67")or die("Unable to instantiate");
but it always shows unable to instantiate??
I have registered the COM object in the server 10.100.120.67
so from server A i am instantiating a COM object in server B(10.100.120.67)
Where i am wrong...from the local machine i am able to do..that is just COM...but when i used DCOM it says unable to instantiate??
Am i missing out anything
pls help me out.
Thanks
Shankar
-
psmshankar
- Forum Commoner
- Posts: 96
- Joined: Tue Aug 06, 2002 4:25 am
- Location: India
not beeing in your php.ini yet doesn't mean you can't add it 
http://www.php.net/manual/en/class.com.php
http://www.php.net/manual/en/class.com.php
-
psmshankar
- Forum Commoner
- Posts: 96
- Joined: Tue Aug 06, 2002 4:25 am
- Location: India
just add the lineto your php.ini and take a look. I don't know it - the manual is kind of preliminary.
Code: Select all
com.allow_dcom=On-
psmshankar
- Forum Commoner
- Posts: 96
- Joined: Tue Aug 06, 2002 4:25 am
- Location: India
in the source code for php 4.2.3 there is a call to CoCreateInstanceEx in <php>/ext/COM/COM.c indicating DCOM support.
-
psmshankar
- Forum Commoner
- Posts: 96
- Joined: Tue Aug 06, 2002 4:25 am
- Location: India
I was only speaking of php 4.2.3.
<?php phpinfo(); ?> should tell wether there is (d)com-support or not. mine tells me
If it is possible for you to upgrade and you think you can manage it, do it.
Is your component accessible by DCOM?
If uncertain search for a dcomcnfg tutorial i.e. with google
<?php phpinfo(); ?> should tell wether there is (d)com-support or not. mine tells me
and I have not a single (active) config-line for com in my php.inicom
Directive Local Value Master Value
com.allow_dcom Off Off
com.autoregister_casesensitive On On
com.autoregister_typelib Off Off
com.autoregister_verbose Off Off
com.typelib_file no value no value
If it is possible for you to upgrade and you think you can manage it, do it.
Is your component accessible by DCOM?
If uncertain search for a dcomcnfg tutorial i.e. with google
-
psmshankar
- Forum Commoner
- Posts: 96
- Joined: Tue Aug 06, 2002 4:25 am
- Location: India
- mydimension
- Moderator
- Posts: 531
- Joined: Tue Apr 23, 2002 6:00 pm
- Location: Lowell, MA USA
- Contact:
-
psmshankar
- Forum Commoner
- Posts: 96
- Joined: Tue Aug 06, 2002 4:25 am
- Location: India
hi mydimension
so can i put the following in my php.ini??
Shankar
so can i put the following in my php.ini??
I will add the above at the end?? then i will restart ?? is it ok..[com]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
com.typelib_file=
allow Distributed-COM calls
com.allow_dcom=true
; autoregister constants of a components typlib on com_load()
com.autoregister_typelib=true
; register constants casesensitive
;com.autoregister_casesensitive=false
; show warnings on duplicate constat registrations
com.autoregister_verbose=true
Shankar
-
psmshankar
- Forum Commoner
- Posts: 96
- Joined: Tue Aug 06, 2002 4:25 am
- Location: India
Hi,
I tried by putting the above piece of code in php.ini file..
but it doesn't seems to work...
following is the content i added in php.ini file
--------------------------------------------------
[com]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
com.typelib_file=
allow Distributed-COM calls
com.allow_dcom=true
; autoregister constants of a components typlib on com_load()
com.autoregister_typelib=true
; register constants casesensitive
com.autoregister_casesensitive=false
; show warnings on duplicate constat registrations
com.autoregister_verbose=true
---------------------------------------------------
following is the piece of code instantiating the COM object in another machine
//************************************************************// Instantiating clsDevice class to check the device status...
//************************************************************
$objDevice = new COM("SMSServer.clsDevice","10.100.120.67") or die("Unable to instantiate SMS Server: clsDevice component");
$objDevice->CheckDeviceStatus();
$DevStatus = $objDevice->DeviceStatus;
it always says 'Unable to instantiate'.....
ofcourse this COM object is registered on the server in which it resides(10.100.120.67) and also i regitered the same in server A where the aboce piece of php code is running...
pls help me to sort it out as i have to do this quickly...
Thanks
Shankar
I tried by putting the above piece of code in php.ini file..
but it doesn't seems to work...
following is the content i added in php.ini file
--------------------------------------------------
[com]
; path to a file containing GUIDs, IIDs or filenames of files with TypeLibs
com.typelib_file=
allow Distributed-COM calls
com.allow_dcom=true
; autoregister constants of a components typlib on com_load()
com.autoregister_typelib=true
; register constants casesensitive
com.autoregister_casesensitive=false
; show warnings on duplicate constat registrations
com.autoregister_verbose=true
---------------------------------------------------
following is the piece of code instantiating the COM object in another machine
//************************************************************// Instantiating clsDevice class to check the device status...
//************************************************************
$objDevice = new COM("SMSServer.clsDevice","10.100.120.67") or die("Unable to instantiate SMS Server: clsDevice component");
$objDevice->CheckDeviceStatus();
$DevStatus = $objDevice->DeviceStatus;
it always says 'Unable to instantiate'.....
ofcourse this COM object is registered on the server in which it resides(10.100.120.67) and also i regitered the same in server A where the aboce piece of php code is running...
pls help me to sort it out as i have to do this quickly...
Thanks
Shankar
if new COM fails it should produce an zend_error that can be found in the server-log.
But as mentioned I think the whole COM-module (or at least the documention) is preliminary. I.e. did you know that server_name can be an array (don't know if it can be in php-ver < 4.2.3).
I found in the sources
'Under' which account does your webserver run? can you login with these (exactly the same) setting on the other server (that 'holds' the component)? If so, can you create a new instance of your component with this account?
And once again: have you checked dcomcnfg?
But as mentioned I think the whole COM-module (or at least the documention) is preliminary. I.e. did you know that server_name can be an array (don't know if it can be in php-ver < 4.2.3).
I found in the sources
...
else if (Z_TYPE_P(server_name) == IS_ARRAY) {...
- if it is an array it fetches the entries
- server_name["Username"]
- server_name["Domain"]
- server_name["Password"]
- server_name["Flags"]
'Under' which account does your webserver run? can you login with these (exactly the same) setting on the other server (that 'holds' the component)? If so, can you create a new instance of your component with this account?
And once again: have you checked dcomcnfg?