Search code examples
php.netiiscomphp-extension

COM does not work in IIS PHP version 7.2.9


I'm having an issue trying to get COM to work on my local Internet Information Services (IIS) server running php: "Fatal error: Uncaught Error: Class 'COM' not found in ..."

HTML,PHP,CSS only (PHP version 7.2.9) new COM("ADODB.Connection")

I have reviewed the following link: PHP - COM does not work in IIS and added:

[COM_DOT_NET] 
extension=php_com_dotnet.dll 

to both php.ini files (i.e., development and production), but the error remains.

I suspect this has something to do with the 7.2.9 version of PHP I have installed with IIS. What is the proper .dll reference for the php.ini files?


Solution

  • It is highly unlikely that PHP is configured to load php.ini-development nor php.ini-production as these files exist mainly for convenience. You need to copy one of those into a php.ini file.

    After you've made the necessary changes, you will likely need to restart your web server.

    Additionally, use phpinfo(); to see your PHP's configuration and look for a row named:

    Loaded Configuration File

    This will tell you which ini file is loaded into PHP's memory.

    phpinfo() will also let you know which extensions have been enabled.

    If you still cannot get the COM extension loaded then you need to check your PHP error logs because they could indicate that you have an incorrect DLL file.