Access QuickBooks from a Windows Service (such as Apache)
Quickbooks Desktop Integration
I was trying to get a Apache/PHP application to interface with Quickbooks using QBXML through the Quickbooks SDK and kept receiving the following error:
- “Could not start Quickbooks”
When looking at the SDK log file (Located at C:\Documents and Settings\All Users\Application Data\Intuit\QuickBooks\qbsdklog.txt), I kept seeing the following error when attempting access the file:
========= Started Connection ========= Request Processor, QBXMLRP2 v7.0 Connection opened by app named 'php QB via Apache' An internal error occured while looking for a running instance of QuickBooks. Cannot continue. hr = 800401f3 Could not create instance of QuickBooks. hr = 8004041c Connection closed by app named 'php QB via Apache' ========== Ended Connection ==========
If I ran my integration application through command prompt (via a .bat file) instead of Apache it worked perfectly. But Apache would not sync. I was running the Apache service as an Administrator which is I though all I needed to do. I was wrong.
Apparently accessing QuickBooks from a Windows service requires special COM permissions, because there are in-process/out-of-process Windows COM issues. We basically need to do three things: configure the COM permissions for QBXMLRP2e (installed with the Quickbooks SDK), configure Apache to run as a Windows user and configure Quickbooks to allow the application to connect.
COM Permissions configuration:
- Make sure the Quickbooks SDK is installed.
- Run command prompt and type: “C:\Program Files\Intuit\IDN\QBSDK7.0\tools\access\QBXMLRP2e\qbXMLRP2e.exe” /RegServerThis adds qbXMLRP2e to the DCOM settings list.
- Run “Component Services” from “Control Panel > Administrator Tools”
- Then from “Console Root > Computers > My Computers > DCOM Config” right click on “qbXMLRP2e” and select Properties
“Authentication level” should be set to Default
Go in Security “Launch and activation” select “Customize” and press Edit. Add the Windows user the service runs as and assign all calling rights. “Access” select “Customize” and press Edit. Add the Windows user the service runs as and assign all. “Configuration” select “Customize” and press Edit. Add the Windows user the service runs as and assign all.
Go in “Identity” tab and select “The interactive user”
Click Apply.
Apache/Quickbooks configuration:
- Make sure Apache is running as the user configured as the DCOM Windows user. Right click on the Apache Monitor and select Open Services. Change the “Log On As” user for the Apache service.
- Open Quickbooks and set it to multi-user mode. Be sure to clear out any applications in “Preference | Application Settings” first to make sure the permission settings get set correctly.
- Run a GUI version of your application accessing quickbooks. For example running your program through command line instead of Apache.
- Follow the prompts in Quickbooks to allow the application access.
- Run the integration through Apache and it should work now!
This took forever to figure out and hopefully it helps someone googling the error codes I was receiving.








