EasyXLS

Why do I get "Failed to create COM object EasyXLS.ExcelDocument: Access is denied" error in PHP?

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

Fatal error: Uncaught com_exception: Failed to create COM object 'EasyXLS.ExcelDocument': Access is denied.

at line:

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

Reason: The web application cannot access EasyXLS.dll

If the web application does not have proper permissions, it cannot access the registered EasyXLS.dll.

Possible solution #1: Set permissions on EasyXLS.dll

The most suitable solution is to give permissions on the EasyXLS.dll that was registered as COM+ on the machine.

If the registration was through EasyXLS installer, the default location of EasyXLS.dll is "<EasyXLS install path>\COM+ version\DLL\EasyXLS.dll".

If EasyXLS.dll was moved and registered from a different location, then EasyXLS.dll must be searched at that location.

Right-click on EasyXLS.dll, choose Properties, Security tab:

EasyXLS.dll, File Properties, Security tab

Check if Everyone user is present. If it is not present, add Everyone user with full control or add the user used by the web application.

Possible solution #2: Set permissions for the web application

Another option is to increase the permissions for the web application.

Open Internet Information Services (IIS) Manager in Control Panel/Administrative Tools. Select Application Pools and the application pool associated with your web application.

IIS Application Pools

Select Advanced Settings and check if Process Model/Identity is set to ApplicationPoolIdentity.

IIS Process Model Identity

If so, change the Identity to LocalSystem:

IIS Application Pool Identity

If the application pool is used by multiple web applications, you might consider creating a new application pool only for the web application that uses EasyXLS.

Warning: Switching to LocalSystem is the easiest solution, but this decrease the security on the machine and it is not recommended for live environments. The best option is to run the web application under a Specific User with lower permissions and give permissions to that user according to Possible solution #1.

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:

.NET
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
XLSXXLSMXLSBXLS
XMLHTMLCSVTXT