Page 1 of 1

Php Class COM not found

Posted: 30 Sep 2020, 09:48
by Admin
I've been trying to use the PHP COM class in my script:

Code: Select all

$voice = new COM('SAPI.SpVoice');
but I get receiving the following error.

Code: Select all

 Fatal error: Class 'COM' not found in /XAMPP/htdocs/test.php on line 3
I've tried to change php.ini and remove the semicolons from COM section.

Code: Select all

[com]
com.typelib_file = 
allow Distributed-COM calls
com.allow_dcom = true
com.autoregister_typelib = true
com.autoregister_casesensitive = false
com.autoregister_verbose = true 
And still getting the same error.
I'm using a XAMMP on Windows.

Php Class COM not found

Posted: 30 Sep 2020, 09:55
by Marius
From PHP 5.4.5, COM and DOTNET is no longer built into the php core.
You have to add COM support in php.ini. Add the following code to the end of the php.ini file:

Code: Select all

[COM_DOT_NET]
extension=php_com_dotnet.dll
Otherwise you will see this in your error log: Fatal error: Class 'COM' not found

The extension is included with php 5.4.5 for Windows.
COM is a Windows-only extension.