Why do I get "Uncaught Error: Class 'COM' not found" error in PHP

The following error might occur at runtime when using EasyXLS Excel library for PHP:

Fatal error: Uncaught Error: Class 'COM' not found

at line:

$workbook = new COM("EasyXLS.ExcelDocument");

The error is raised because PHP server does not allow creating COM objects from .NET.

Reason: COM and .NET extension not enabled

In order to enable COM and .NET extension in PHP, add the following lines in php.ini:


php.ini file can be found at the location where PHP was installed.

Enable COM and .NET in PHP.ini

Restart IIS Server.

Contact us for any other reasons

If none of the above, contact us at support@easyxls.com with details about your application configuration and the full error message.

Available for: Professional, Excel Writer, Excel Reader, Express Excel Writer
Go to top

EasyXLS Excel libraries:

Excel Library for PHP
full COM+ version to import, export or convert Excel files
Excel Writer for PHP
COM+ version to create and export Excel files
Excel Reader for PHP
COM+ version to read and import Excel files
Express Excel Writer for PHP
limited COM+ version to create and export Excel files in predefined formats
Download EasyXLS™ Excel Library for .NET

File formats:

Office 365
MS Excel 2021 - 2024
MS Excel 2007 - 2019
MS Excel 97 - 2003