php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77503 COM does not work in v5.6
Submitted: 2019-01-23 00:53 UTC Modified: 2019-01-26 19:21 UTC
From: pch at astrowin dot org Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 7.2 OS: Windows 8.1
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: pch at astrowin dot org
New email:
PHP Version: OS:

 

 [2019-01-23 00:53 UTC] pch at astrowin dot org
Description:
------------
Using PHP v5.4.45 the following works as expected:

    $obj = new COM("astro_php_h.astro_php_h_class");

but in PHP v5.6.39 or 5.6.40 and above (up to and including v7.2), it does not work, always giving me an error message that "Class not registered" or this error message using XAMPP "Fatal error: Class 'COM' not found in C:\My Documents\My Webs\connexions.com\public_html\astro5\allen\test_dll.php on line 15".

I am using the same everything on my computer except for the PHP version. My phpinfo() file shows that the com_dotnet extension is enabled and active.


Test script:
---------------
  try
  {
    $obj = new COM("astro_php_h.astro_php_h_class");
  }
    catch (com_exception $e)
  {
    echo "<br> I cannot load the DLL.";
  }



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-01-23 09:30 UTC] nikic@php.net
-Status: Open +Status: Feedback
 [2019-01-23 09:30 UTC] nikic@php.net
If it says "Class 'COM' not found", that means that the extension is not loaded. Please check if the extension is present (and not commented out) in your php.ini file.
 [2019-01-23 18:59 UTC] pch at astrowin dot org
-Status: Feedback +Status: Open
 [2019-01-23 18:59 UTC] pch at astrowin dot org
Yes, phpinfo said com_dotnet was installed and active. As I mentioned in my original note.
 [2019-01-24 12:31 UTC] cmb@php.net
-PHP Version: 5.6.40 +PHP Version: 7.2
 [2019-01-24 12:31 UTC] cmb@php.net
> "Class not registered"

This might be a 32bit vs. 64bit issue (aka x86 vs x64).

> Fatal error: Class 'COM' not found

This is almost certainly caused by the php_com_dotnet.dll not
being loaded (like @nikic already suggested).  Try something like:

  var_dump(class_exists('COM'));

Also note that only PHP-7.2 and up will receive non-security
related bug fixes.
 [2019-01-24 19:39 UTC] pch at astrowin dot org
>>  var_dump(class_exists('COM'));

Returns True for PHP v5.4 and PHP v5.6.

>> This is almost certainly caused by the php_com_dotnet.dll not
being loaded

I'll say it for the 3rd time, phpinfo() says that the com_dotnet extension is loaded and active.

>> This might be a 32bit vs. 64bit issue (aka x86 vs x64).

I don't understand this comment when the two PHP versions are both run on the same Windows 8.1 64-bit machine, and XAMPP has been set up with the 64-bit versions.

I realize it is difficult to "debug" something without it right in front of you. But can't someone take a .dll and test the COM function in different PHP versions, just as I am doing? I suspect you will see what I am talking about.

In any case, for my local system, I'm thinking, "Why do I need to waste my time working with PHP v5.6 - v7.2 when they don't work like v5.4?" The only reason I need this DLL is because using exec() with Windows is very slow because of the forking that Windows does. If I could get rid of that, then I would not need the DLL, which works at least 10 times faster than exec() on Windows.
 [2019-01-25 11:44 UTC] ab@php.net
-Status: Open +Status: Feedback
 [2019-01-25 11:44 UTC] ab@php.net
Where do you run phpinfo(). WAMP distributions often use different php.ini for console and web server bins. Please check that, too.

Also, if the assembly you use is 32-bit - use 32-bit binaries of PHP. Same for 64-bit.

To register your assembly, use `regsvr32 c:\path\to\my.dll`. If you can share your assembly dll, i could check it, too.

Hopefully that clarifies a bit more.

Thanks.
 [2019-01-26 01:53 UTC] pch at astrowin dot org
-Status: Feedback +Status: Open
 [2019-01-26 01:53 UTC] pch at astrowin dot org
I am e-mailing you directly at ab@php.net. I can send you a .zip file with the DLL and a test script. It does not appear this forum allows attachments.
 [2019-01-26 02:04 UTC] ab@php.net
@pch at astrowin dot org, this doesn't sound right. Please check what i've asked you to before sending files. Thanks.
 [2019-01-26 19:21 UTC] pch at astrowin dot org
-Status: Open +Status: Closed
 [2019-01-26 19:21 UTC] pch at astrowin dot org
Close this report.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 04 07:01:26 2024 UTC