ID: 43506
Comment by: gerrit at timingteam dot nl
Reported By: bvandermerwe at kbcat dot com
Status: Open
Bug Type: COM related
Operating System: Windows XP
PHP Version: 5.2.5
New Comment:
I experienced the same problem. Googling the internet I found a clue.
Somebody had a likewise problem. But he noticed that it only happened
when Apache was started as a service and not when Apache was started in
a console. I checked this in my situation. And indeed, all works fine
when you start Apache in a console. And you get the reported problem
when you start Apache as a service.
Hope this gives some clue to resolving the problem.
Greets, Gerrit.
Previous Comments:
------------------------------------------------------------------------
[2008-11-06 11:46:02] tom dot neil dot bell at gmail dot com
Suffered this issue today trying enumerate a internet explorer
window. Turns out Internet Explorer doesn't register it self with the
"Running Object Table" so this function returns that error.
Work arounds are to either create a Browser Helper Object that will
add the IE instance to the ROT, or enumerate all windows via the
Shell.Application COM and iterate through them looking for
iexplore.exe .
Tom
------------------------------------------------------------------------
[2007-12-05 18:14:58] bvandermerwe at kbcat dot com
Description:
------------
com_get_active_object always returns "Operation Unavailable " even when
it should work for sure. Let me demonstrate:
Start up Microsoft Word (for example) on the server machine where
Apache and PHP are running. Then put the following text in a file called
x.vbs:
Dim app
Set app = GetObject(,"Word.Application")
if app is nothing then
wscript.echo "Got nothing"
else
wscript.echo "Got it!"
end if
Execute it by typing: cscript x.vbs.
Note that it works fine. Yet the following line in a PHP script always
returns "Operation Unavailable ":
$obj = com_get_active_object("Word.Application");
Using: $obj = new COM("Word.Application") works (meaning PHP COM is
working).
I just upgraded Apache to 2.2.6 and PHP 5.2.5 (using the Windows
installation executable binaries with pretty much default settings,
except PHP is in c:\PHP525 and I checked the options for MS and MYSQL
databases). Bugzilla and several PHP applications all work fine.
But it seems com_get_active_object *always* fails. I have Googled and I
can not find any examples of it out there or any security or other
settings related to it.
If it just calls GetObject, then how come calling GetObject from
VBScript works but in PHP does not? I did discover that some GetObject
calls are disabled under IIS for security reasons, but I am using Apache
and there is no reference to any setting that needs to be turned on
before this will work.
Reproduce code:
---------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"
/>
<title>Test</title>
</head>
<body>
<?php
echo("<p>Attempting to retrieve COM Object</p>");
$obj = com_get_active_object("Word.Application"); //Fails!
if ($obj) {
echo("<p>Object Found</p>");
} else {
echo("<p>Object NOT Found</p>");
}
?>
</body>
</html>
Expected result:
----------------
No error. You should see:
Attempting to retrieve COM Object
Object Found
Actual result:
--------------
You see:
Attempting to retrieve COM Object
If PHP error tracing is enabled you also see:
Fatal error: Uncaught exception 'com_exception' with message 'Operation
unavailable ' in C:\ApacheDocumentRoot\test_com.php:10 Stack trace: #0
C:\ApacheDocumentRoot\test_com.php(10):
com_get_active_object('Word.Application') #1 {main} thrown in
C:\ApacheDocumentRoot\test_com.php on line 10
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43506&edit=1