alseether
alseether

Reputation: 1993

Fatal Error Class COM not found with extension php_com_dotnet installed

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:

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?

Upvotes: 0

Views: 466

Answers (1)

alseether
alseether

Reputation: 1993

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).

Upvotes: 1

Related Questions