Fatal Error Class COM not found with extension php_com_dotnet installed

28
February 12, 2019, at 6:50 PM

I've recently installed PHP 5.6.37 on a Windows Server 2012 R2 machine.

PHP folder has been copied from a Windows 10 machine where it works fine. Because it isn't a proper installation, I've manually added C:\php to the PATH environment variable.

When I try to run some code which uses COM classes, it throws:

Fatal error: Class 'COM' not found in XXXX on line 42

Looking for a solution and I found this answers:

  • Class 'COM' not found
  • PHP Fatal error: Class 'COM' not found

But none of those worked for me, because both (extensions and php.ini file) were fine, since it worked on the Windows 10 machine before.

Where the issue could be then?

Answer 1

PHPRC Environment Variable was missing

PHPRC = C:\php

After looking around a little bit more, I found the problem was caused by the manual copy of the PHP folder, because I've skipped the installation with the .msi file. The installation file not only add PHP folder to PATH variable but it also creates a new variable called PHPRC which determines where the Runtime Configuration is located (C:\php by default).

READ ALSO
Azure AD SSO = AADSTS50020 - multi-tenant, How do I allow external tenants to register to my app?

Azure AD SSO = AADSTS50020 - multi-tenant, How do I allow external tenants to register to my app?

We have a SaaS app and we are integrating with azure ad sso with oauth2 (locally for now) using https://githubcom/TheNetworg/oauth2-azure (v2 common endpoint)

23
Fatal error: Cannot redeclare __() (previously declared in D:\wamp\apps\phpMyAdmin\libraries\sql-parser\src\common.php:17)

Fatal error: Cannot redeclare __() (previously declared in D:\wamp\apps\phpMyAdmin\libraries\sql-parser\src\common.php:17)

I was working with PMA as always but today PMA freezes when I tried a simple requestSo I tried to reload the browser (Chrome), but now I can't access anymore to PMA due to the following error :

13
using multi prefix in one route

using multi prefix in one route

I have created a project with symfony 34

41
Unable to use the sylius services

Unable to use the sylius services

Service "syliusrepository

19