Note that there are some explanatory texts on larger screens.

plurals
  1. POCode to generate Crystal Reports report works fine in CLI, but "Data source name not found" when accessed from browser
    text
    copied!<p>I'm trying to generate a report from PHP, using Crystal Reports, The code seems to be correct:</p> <pre><code>&lt;?php set_time_limit(0); if(isset($_GET['id'])) { $id = $_GET['id']; } else { die('Please specify an ID'); } $path = "c:\\wamp\\www\\billing\\reports"; $file = $chemin."\\bill_".$id.".pdf"; $app_obj = new COM("CrystalRuntime.Application") or Die ("Did not open"); $report= $path."\\bill.rpt"; $rpt_obj= $app_obj-&gt;OpenReport($report,1); $app_obj-&gt;LogOnServer("p2ssql.dll","host","bdd","userbd","passwordbd"); $rpt_obj-&gt;EnableParameterPrompting = FALSE; $rpt_obj-&gt;RecordSelectionFormula = "{F_DOCLIGNE.DO_Piece}='$id'"; $rpt_obj-&gt;ExportOptions-&gt;DiskFileName = $file; $rpt_obj-&gt;ExportOptions-&gt;PDFExportAllPages = true; $rpt_obj-&gt;ExportOptions-&gt;DestinationType = 1; $rpt_obj-&gt;ExportOptions-&gt;FormatType = 31; $rpt_obj-&gt;Export(false); header("Content-Type: application/pdf"); readfile($file); ?&gt; </code></pre> <p>If I run the script from command line, it works just fine, and I have the PDF exported and parsed in the console.</p> <p>But from a browser's point of view, the story is different, If you get the request through Apache, I get this exception :</p> <pre><code>com_exception: Source: Crystal Reports ActiveX Designer Details : IM002:[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified in C:\wamp\www\facture\report.php on line 25 </code></pre> <p>On the report, the database connection is made through ODBC, I couldn't use that, as any other driver, marked with ODBC refused to work.</p> <hr>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload