|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46522 Problem using new com
Submitted: 2008-11-08 03:23 UTC Modified: 2020-07-05 04:22 UTC
Avg. Score:4.2 ± 0.9
Reproduced:10 of 10 (100.0%)
Same Version:2 (20.0%)
Same OS:6 (60.0%)
From: dezzell at gamanetworks dot com Assigned: cmb (profile)
Status: No Feedback Package: COM related
PHP Version: 5.2.6 OS: Windows 2003 Server
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: dezzell at gamanetworks dot com
New email:
PHP Version: OS:


 [2008-11-08 03:23 UTC] dezzell at gamanetworks dot com
I'm having problems getting COM objects to work. I'm trying to get Crystal Reports to work with my PHP application and have been working on this for the past 2 days. I've done so many searches and have tried every example I have come across. I always get HTTP 500 server errors with PHP Fatal errors in the log files when trying to load COM objects.
I have PHP 5.2.6 installed on two different Windows 2003 servers, one with IIS 6 and the other with Apache HTTP 2.2 server. PHP works great on both servers, but when I try to create a new com object, I get an HTTP 500 error. Below is some of the code that I have tried with no success.

$creport=new com("CrystalReports12.ObjectFactory.1 ") or die("cannot load cr com");
$o_CrApplication = $creport ->CreateObject("CrystalDesignRunTime.Application");
$o_CrApplication = $creport ->CreateObject("CrystalRunTime.Application");
$o_CrApplication = $creport ->CreateObject("CrystalRunTime.Application.12");
I have tried other com objects and get the same HTTP 500 error.
$fso = new COM("Scripting.FileSystemObject");
$f = $fso->GetFile("c:\\test.txt");

I checked my php.ini and made changes to the [com] section, but still have problems.
com.allow_dcom = true
com.autoregister_typelib = true
From the command prompt, I run php -r "new COM('CrystalReports12.ObjectFactory.1')-> CreateObject('CrystalRuntime.Application.12');" and do not get any errors or warnings. 
I currently have Crystal Reports 12 installed and even tried to test with version 9, but always get the HTTP 500 error with log errors such as the following:
PHP Fatal error:  Uncaught exception 'com_exception' with message '<b>Source:</b> Unknown<br/><b>Description:</b> Unknown'
PHP Fatal error:  Call to undefined method com::OpenReport()
PHP Fatal error:  Uncaught exception 'com_exception' with message 'Failed to create COM object

I need to get this to work and can't seem to find the solution. Let me know if you need me to provide any additional information.



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-06-25 16:05 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-06-25 16:05 UTC]
Do you still experience these problems with any of the actively
supported PHP versions[1]?

[1] <>
 [2020-07-05 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 16:01:29 2024 UTC