php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33596 ADOMD COM works, DCOM doesn't
Submitted: 2005-07-06 23:55 UTC Modified: 2005-08-29 10:38 UTC
From: marko dot sirovnik at korona dot si Assigned: wez (profile)
Status: Closed Package: COM related
PHP Version: 5.0.4 OS: Windows 2003 Server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: marko dot sirovnik at korona dot si
New email:
PHP Version: OS:

 

 [2005-07-06 23:55 UTC] marko dot sirovnik at korona dot si
Description:
------------
Hi!

I'm using ADOMD COM object in order to connect to OLAP database. When the Web Server and the DB Server are on the same computer I can manage to connect to OLAP DB (COM approach). But when DB Server is on on PC and Web Server on another PC it is impossible for me (DCOM connection).

Short configuration:
  OS: Windows 2003 Server
  Web: IIS (comes with Win2003Srv)
  DB: Microsoft SQL Server
  OLAP: Microsoft Analysis Services
  COM/DCOM object: ADOMD
-----------------------
PHP.INI
[com]
;com.typelib_file = 
com.allow_dcom = true
com.autoregister_typelib = true
;com.autoregister_casesensitive = false
;com.autoregister_verbose = true
------------------------

I made ADOMD DCOM test with Visual Basic and it works fine.

Any help or idea how to remove this obstacle I appreciate.

Thanks to All!
Marko

Reproduce code:
---------------
<?php
	$dsn = 'DATA SOURCE=blackbox;UID=sa;Initial Catalog=FoodMart 2000;Provider=MSOLAP;Encoding=windows-1250;Roles=skrbnik;';
	//$cat = new COM('ADOMD.Catalog');
	$cat = new COM('ADOMD.Catalog', array(
		"Server" => "blackbox",
		"Username" => "administrator",
		"Password" => "default"));
    if (is_null($cat)) {
        echo '<B>Sorry, problem with COM object.</B><BR>';
        echo '$cat = ' ;
        var_dump ($cat);
        return;
    } else {
    	echo '<BR><B>Connection with OLAP has been established.</B>';
    }
	$cat->ActiveConnection = $dsn;
    var_dump ($cat);
?> 

Expected result:
----------------
DCOM connection should be different then "Null". Furthermore, a message "Connection with OLAP has been established." is expected to be seen in Web browser.

Actual result:
--------------
With PHP Version 4.3.6 the following warrning has arrised:
"Unable to obtain IDispatch interface for CLSID {228136B0-8BD3-11D0-B4EF-00A0C9138CA4}: Class not registered in c:\inetpub\wwwroot\aaa1.php on line 3
Sorry, problem with COM object."

PHP Version 4.4.0RC3-dev:
"PHP has encountered an Access Violation at 0184A8A8?$?? ?Ew?????? ?U?\??????????c?O2????Ty ?m?OqeRV#88?N???????<_N>?U"?????JD&#378;p???r'???)JK]v^?M7???Z??6?C??P?\??v???8d?? <?/?"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-08 20:38 UTC] marko dot sirovnik at korona dot si
Thank you for your quick resonse. In my previous description I forgot to mention that Excel works also over DCOM already in version 4.3.6.

So...
I have upgraded PHP to ver.:5.0.4 (Mar 31 2005). The previous observations and problem remains at it was. Here is the actual result:

------------
Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `ADOMD.Catalog': Access is denied. ' in c:\Inetpub\wwwroot\aaa1.php:8 Stack trace: #0 c:\Inetpub\wwwroot\aaa1.php(8): com->com('ADOMD.Catalog', Array) #1 {main} thrown in c:\Inetpub\wwwroot\aaa1.php on line 8
-------------

Any idea what could be a problem?

Thanks for the answer. 
Marko
 [2005-07-08 21:37 UTC] wez@php.net
You have to configure the permissions on that DCOM server to allow the web server to access it.
If you do that, you need to consider how it might affect the overall security of your system (say there was a remote eval() bug in something else running on your web server).

Since this is a local configuration issue, it's not a bug in PHP, so I'm marking it as bogus.  You need to read up on DCOM security and configuration to resolve your problem.
 [2005-08-17 10:48 UTC] marko dot sirovnik at korona dot si
After some testing and checking securities on both servers I have found out that ADOMD is not meant to be a DCOM object. Namely, in the connection string is written all necessary connection information (server, user, pass, OLAP Cube, etc.). In my case this is stored in variable ?$dsn?.

Therefore, I have tried to connect to ADOMD COM object locally. In my reproduce code written above I have replaced the following line:
$cat = new COM('ADOMD.Catalog', array(
		"Server" => "blackbox",
		"Username" => "administrator",
		"Password" => "default"));
with line
$cat = new COM('ADOMD.Catalog');

The connection with OLAP is established but the problem comes in the following line:
$cat->ActiveConnection = $dsn;


Result in Browser:

Connection with OLAP has been established.
Fatal error: Uncaught exception 'com_exception' with message 'Source: Microsoft? OLE DB Provider for Analysis Services
Description: Property name was not recognized, 'Encoding''

So, communication is OK, only the parameters stored in ?$dsn? are ?wrong? or they supposed to be wrong. And why this doubt? 

I have checked the same syntax also with VisualScript code stored in VBS file and works fine with all parameters. Here is the testing example:

Dim cat
Set cat = CreateObject("ADOMD.Catalog")
cat.ActiveConnection = "DATA SOURCE=blackbox;UID=sa;Initial Catalog=FoodMart 2000;Provider=MSOLAP;Encoding=windows-1250;Roles=skrbnik;"
MsgBox cat.Name

My impression is that ADOMD COM object works fine with windows technology (VisualBasic, ASP, etc.) but has problem when is called from PHP. 

I still suspect that could be a PHP internal problem when using ADOMD COM object. What is your opinion? Could you check this PHP and VBS code by yourself?

Thanks, Marko
 [2005-08-17 16:53 UTC] wez@php.net
PHP doesn't touch the content of your strings (except to convert to UTF-16); it passes them on to the COM server, and its the COM server that's reporting an error.

It seems unlikely that PHP is the cause.

Can you try running your .vbs file from the same environment as PHP?

eg:  Create a PHP page that calls system("cscript.exe test.vbs") and then request that PHP page from your browser.

(you will probably need to replace the MsgBox line with Echo)


 [2005-08-19 11:10 UTC] marko dot sirovnik at korona dot si
1. I put Read & Execute permissions on "cmd.exe" and "cscript.exe".

2. OLAP.VBS
----------------
  Dim cat 
  Set cat = CreateObject("ADOMD.Catalog")
  cat.ActiveConnection = "DATA SOURCE=blackbox;UID=sa;Initial Catalog=FoodMart 2000;Provider=MSOLAP;Encoding=windows-1250;Roles=skrbnik;"

3. COM_VBS.php
-------------------
<?php
 $r = system('cscript.exe c:\OLAP.vbs', $a);
 echo "Result = " . $a;
?> 

4.Result in Browser
---------------------
Result = 1

No idea, does it work or does it not.

There is no difference in result in Browser concerning of changes the DATA SOURCE parameter in Connection string. Either Local or Remote OLAP server, the result is the same. 

Did I miss something?
 [2005-08-19 11:47 UTC] sniper@php.net
Wezzie? :)

 [2005-08-19 13:59 UTC] wez@php.net
You're supposed to have the vbs echo something to indicate if it worked or not.
 [2005-08-27 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2005-08-29 10:38 UTC] marko dot sirovnik at korona dot si
Hi!

During some experimentation I found out that there was security problem in IIS. Sorry Wez to bother you all this time. You were right already at the beginning. Details with solution for my problem are presented here:
http://dbforums.com/t527031.html

Thanks for the answers and effort.

Regards, Marko.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 00:01:30 2024 UTC