ID: 43506
User updated by: bvandermerwe at kbcat dot com
Reported By: bvandermerwe at kbcat dot com
Status: Open
Bug Type: COM related
Operating System: Windows XP
PHP Version: 5.2.5
New Comment:
Yes when Apache runs as a service it runs under a different user
than when you start it from the command line. You can change the user
the service uses, though that does not fix it. We have had the same
issues with .NET services. You just get these permission type errors no
matter how much you Google for the proper settings. And Microsoft's
official position on this situation is that you should not be using
Excel/Word from a service. Gotta love Microsoft... hahaha.
Of course in our case we are not using Excel/Word really, I use them as
an example hoping that:
- Someone can post how you fix/set these permissions to get around
this, if that is the cause.
- Perhaps PHP can be enhanced to return a more complete error message.
"Operation unavailable" is useless (it could mean anything, e.g. this
type of operation is not available because PHP no longer supports it or
because PHP module xx is not installed, who knows). Rather something
like "Unable to instantiation COM Object due to insufficient user
permission" would help?
Previous Comments:
[2009-01-03 21:47:22] gerrit at timingteam dot nl
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.
[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:
---
http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>
http://www.w3.org/1999/xhtml"; lang="en-US">
Test
Attempting to retrieve COM Object");
$obj = com_get_active_object("Word.Application"); //Fails!
if ($obj) {
echo("Object Found");
} else {
echo("Object NOT Found");
}
?>
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):