|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36959 ReadRecords Method (Crystal Reports XI) Hangs
Submitted: 2006-04-03 14:10 UTC Modified: 2008-11-27 13:21 UTC
Avg. Score:4.4 ± 0.9
Reproduced:11 of 12 (91.7%)
Same Version:10 (90.9%)
Same OS:8 (72.7%)
From: djogopatrao at gmail dot com Assigned:
Status: Not a bug Package: COM related
PHP Version: 5.1.2 OS: Windows XP
Private report: No CVE-ID:
 [2006-04-03 14:10 UTC] djogopatrao at gmail dot com
In order to verify this, you need 

1) crystal reports XI version 2 (free download for trial at

2) access to a database

3) a report that uses data from this database

the code above hangs when invoking the ReadRecords method. A equivalent code was tested and worked OK under Visual Fox Pro.



Reproduce code:
$my_report = "c:\\report1.rpt";
$my_pdf = "c:\\report1.pdf";

$ObjectFactory= New COM("CrystalReports115.ObjectFactory.1");
$crapp = $ObjectFactory->CreateObject("CrystalDesignRunTime.Application");
$creport = $crapp->OpenReport($my_report, 1);
$creport->ReadRecords(); //hangs here
$creport->ExportOptions->DestinationType=1; // Export to File
$creport->ExportOptions->FormatType=31; // Type: PDF

Expected result:
It would create a file (name $my_pdf) with the report. 

Actual result:
It hangs.


CrystalReport_php_support (last revision 2013-10-18 10:13 UTC) by yr dot bhavsar at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-03 14:23 UTC]
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PHP.

Please define "hangs" and add more information if possible.
 [2006-04-03 14:33 UTC] djogopatrao at gmail dot com
When I say that it hangs, I mean that the browser keeps on loading the page forever, until it gets timeout.

More information? I would gladly give an example report file, but as it depends on a database server and ODBC configuration, I don't know how to proceed.

Please contact me if is there anything that I can do.

 [2006-04-03 14:49 UTC]
Error log entries related to the problem would be more helpful than just "hangs".
Also, you can try to run the same code with PHP CLI and check for any error messages.
 [2006-04-03 15:41 UTC] djogopatrao at gmail dot com
I modified slightly the code (see below, I called it hang.php)

Running thru apache2, it hangs. No response from the browser  (it's still "loading", started 2h ago). No entries in "error.log" since then. Commenting the $creport->ReadRecords(); line, it works.

But when running by PHP CLI

C:\>"Arquivos de programas\Apache Group\Apache2\bin\php.exe" hang.php


It runs just fine!

--------- hang.php

$my_report = 'C:\Arquivos de programas\Apache Group\Apache2\htdocs\webdisc\relatorios\cadastro1.rpt';
$my_pdf = 'c:\18530.pdf';

$ObjectFactory= New COM("CrystalReports115.ObjectFactory.1");
$crapp = $ObjectFactory->CreateObject("CrystalDesignRunTime.Application");
$creport = $crapp->OpenReport($my_report, 1);
$creport->ReadRecords(); //hangs here, not thru PHPCLI
$creport->ExportOptions->DestinationType=1; // Export to File
$creport->ExportOptions->FormatType=31; // Type: PDF
 [2006-05-22 15:34 UTC] i_geber at hotmail dot com
If I would like to call a report that has parameters, how do I write the syntax?

 [2007-08-15 08:37 UTC]
Assigned to the maintainer.
 [2008-06-06 12:53 UTC]
Most likely this is not a bug. I've just started using Crystal XI with PHP5. One of the things that happens for me is I get a dialogue asking to login to the DB being used by the report.


 [2008-11-27 11:06 UTC] hummerok at gmsil dot com
this is not a bug. probably you have some alerts when you open this 
report in designer. all you need - just to update it and thos alert 
will gone. another reason: when you set parameters from your program 
you need to set $creport->EnableParameterPrompting = 0; - this also 
might help. I had problems like this - solved
 [2008-11-27 11:22 UTC]
not a bug  > bogus
 [2008-11-27 13:21 UTC] djogopatrao at gmail dot com

Please refer to my previous comment at 3 Apr 2006, in which I tested the same code with PHP-CLI and it worked fine, but without any pop-ups. When generating the report from CR, no pop-ups appeared too. That particular rpt file had all the connection information.

I also remember that it wasn't related to some connection problem - if the settings were incorrect, it would throw a exception instead of hanging.

It was 2 years ago, and I don't know anymore where the bug setup files are, but if you wish I can spend some time looking for it.
 [2010-03-12 08:49 UTC] girlmauhong85 at yahoo dot com
i work with Crystal Report 10 and i work only onnce time. When i try again, i get the following error:Fatal error: Uncaught exception 'com_exception' with message '<b>Source:</b> Crystal Reports ActiveX Designer<br/><b>Description:</b> Unbekannter Abfragemodulfehler' in C:\xampp\htdocs\neu\BescheinigungPDF.php:28 Stack trace: #0 C:\xampp\htdocs\neu\BescheinigungPDF.php(28): variant->LogOnServer('p2sifmx', 'name', 'name', 'acc', 'pass') #1 C:\xampp\htdocs\neu\BescheinigungPDF.php(123): BescheinigungPDF->getPDF('20062', 99898989) #2 {main} thrown in C:\xampp\htdocs\neu\BescheinigungPDF.php on line 28

my code:
function getPDF($sem,$mtknr){
        // Create an Crystal Object Factory.    
        $o_CrObjectFactory = new COM('CrystalReports10.ObjectFactory.1')or die ("Error on load");
        try {
            $o_CrApplication = $o_CrObjectFactory->CreateObject("CrystalRunTime.Application");
        } catch (com_exception $e){
            echo("<br>Error on instance creation:<br>".$e->getMessage().'<p>'.$e->getTraceAsString().'</p>');
            echo "<p><pre>".print_r($e, true)."</pre></p>";
        // Register the typelibrary.
        // Load the report.
        $o_CrReport = $o_CrApplication->OpenReport('C:\xampp\apache\Studienbescheinigung.rpt', 1);// 1== crOpenReportByTempCopy.
        $o_CrReport->Database->LogOnServer('p2sifmx', 'name', 'name', 'acc', 'pass');
        $o_CrReport->DisplayProgressDialog = False;
        $s_ExportedReport = 'C:\xampp\apache\test.pdf';
        $str = "{sossys.aktsem} = $sem and {sos.mtknr} = $mtknr";
        // Run the report and save the PDF to disk.
        $o_CrReport->ExportOptions->DiskFileName = $s_ExportedReport;
        $o_CrReport->ExportOptions->PDFExportAllPages = true;
        $o_CrReport->ExportOptions->DestinationType = 1; // Export to File
        $o_CrReport->ExportOptions->FormatType = 31; // 31 = PDF, 36 = XLS, 14 =DOC
        $o_CrReport->EnableParameterPrompting = 0;
        $o_CrReport->DiscardSavedData;  //remove die saved Datei
        $o_CrReport->ReadRecords(); //force it to update the data in the report from the ADO.command,(Does not work).

        $o_CrApplication = null;
        print "...done";
        var_dump($o_CrReport->RecordSelectionFormula);  /*****/

My chef think, i shoul programm in java but every thing i worked with php(my programm work for an card terminal). Should i make an connection between php and java to call my crystal report?
Please help me, thank you very much!!!
 [2014-07-08 11:44 UTC] syerif at gmail dot com
I have problem with set parameterFields SetCurrentValue in date format anybody can help me?
PHP Copyright © 2001-2015 The PHP Group
All rights reserved.
Last updated: Sun Nov 29 10:01:38 2015 UTC