Php Class COM not found

Discuss coding issues, and scripts related to PHP and MySQL.
Admin
Site Admin
Posts: 805

Php Class COM not found

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.

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.

Similar Topics