'PHP APACHE - PHP binds to COM from Command Prompt but not within Apache
I have a COM Object called COMToy.
PHP can load and execute from a command prompt:
toy.php has these lines in it:
$Interface = new COM("COMToyServer.COMToy") or die("Unable to instantiate your App.");
$sink = new ICOMToyEvents();
com_event_sink($Interface, $sink, "ICOMToyEvents");
From command prompt:
C:\PHP>php toy.php/?Bozo is a clown
which returns:
1. COMToy recieved this text :
Bozo is a clown
<br>COMToy Says :
Thanks for your message:
Bozo is a clown
C:\PHP>
There is no doubt the class is registered and can be accessed and events can be triggered by PHP.
But when called from Apache I get this error:
Fatal error: Uncaught Error: Class 'COM' not found in C:\Apache24\htdocs\toy.php:86 Stack trace: #0 {main}
PHP loads the com module:
C:\PHP>php -m
returns:
[PHP Modules]
com_dotnet
I've tried just about everything possible.
My environment is:
Apache/2.4.46 (Win32) PHP/7.4.10
Microsoft Windows 10 Home Version 10.0.19043 Build 19043
This was working on earlier versions of Windows/Apache/PHP. Is there anyone who can please help.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
