PHP & Crystal Reports - Can't quit ActiveX Designer session

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • MartyInOz

    PHP & Crystal Reports - Can't quit ActiveX Designer session

    Hi,

    I'm currently running Crystal Reports 8.5 from PHP using COM..(yes I
    know that is an older version of Crystal)...I am also running PHP on
    localhost.

    The following code:

    <?php
    $crapp = new COM ("CrystalRuntim e.Application") or die ("Error on
    load");
    $creport = $crapp->OpenReport(" c:/test.rpt", 1);
    $creport->ExportOption s->DiskFileName=" c:/test.rtf";
    $creport->ExportOption s->DestinationTyp e=1; // Export to File
    $creport->ExportOption s->FormatType=4 ; // Type: RTF
    $creport->DiscardSavedDa ta();
    $creport->Export(false );

    $creport = null;
    $crapp = null;

    print "...done";
    ?>

    works fine until I run it more than 5 times, at which point I get the
    error:

    "Warning: Invoke() failed: Exception occurred. Source: Crystal Reports
    ActiveX Designer Description: There are not enough Concurrent Access
    Licenses to log you on. This system has 5 Concurrent Access
    Licenses."..etc ..etc..

    Now I know why this is happening. I assume it is because I am not
    closing the COM instances of 'Crystal Reports ActiveX Designer'. I am
    setting the '$crapp' object to null but I guess this still leaves the
    actual App instantiated. However, I can't find out how to
    programmaticall y close the App. I have tried:

    $crapp->Close();
    $crapp->Quit();

    Does anyone know either the command(s) I require to cleanup my 'Crystal
    Reports ActiveX Designer' session, or if not, can you suggest a good
    reference for the Crystal 8.5 COM commands because I can't find one.

    Thanks...;)

  • NC

    #2
    Re: PHP &amp; Crystal Reports - Can't quit ActiveX Designer session

    MartyInOz wrote:
    >
    "Warning: Invoke() failed: Exception occurred. Source: Crystal Reports
    ActiveX Designer Description: There are not enough Concurrent Access
    Licenses to log you on. This system has 5 Concurrent Access
    Licenses."..etc ..etc..
    What version of PHP are you using?
    Now I know why this is happening. I assume it is because I am not
    closing the COM instances of 'Crystal Reports ActiveX Designer'. I am
    setting the '$crapp' object to null but I guess this still leaves the
    actual App instantiated. However, I can't find out how to
    programmaticall y close the App. I have tried:
    >
    $crapp->Close();
    $crapp->Quit();
    >
    Does anyone know either the command(s) I require to cleanup my 'Crystal
    Reports ActiveX Designer' session, or if not, can you suggest a good
    reference for the Crystal 8.5 COM commands because I can't find one.
    Not really, but here are two possibilities:

    1. Try to enumerate the CrystalRuntime. Application object
    and see if anything has a name that sounds usable in
    your situation:

    $crapp = new COM ("CrystalRuntim e.Application")
    or die ("Error on load");
    echo "<p>Enumera ting CrystalRuntime. Application object:</p>";
    $crapp->Reset();
    while ($e = $crapp->Next()) {
    echo "<p>$e</p>";
    }

    Obviously, this is a development-time hack; you should
    put the code above into a separate script and delete the
    script when you no longer need it.

    2. If all else fails, use $crapp->Release() to force unloading
    of the CrystalRuntime. Application object.

    Cheers,
    NC

    Comment

    • MartyInOz

      #3
      Re: PHP &amp; Crystal Reports - Can't quit ActiveX Designer session


      NC wrote:
      MartyInOz wrote:

      "Warning: Invoke() failed: Exception occurred. Source: Crystal Reports
      ActiveX Designer Description: There are not enough Concurrent Access
      Licenses to log you on. This system has 5 Concurrent Access
      Licenses."..etc ..etc..
      >
      What version of PHP are you using?
      >
      Now I know why this is happening. I assume it is because I am not
      closing the COM instances of 'Crystal Reports ActiveX Designer'. I am
      setting the '$crapp' object to null but I guess this still leaves the
      actual App instantiated. However, I can't find out how to
      programmaticall y close the App. I have tried:

      $crapp->Close();
      $crapp->Quit();

      Does anyone know either the command(s) I require to cleanup my 'Crystal
      Reports ActiveX Designer' session, or if not, can you suggest a good
      reference for the Crystal 8.5 COM commands because I can't find one.
      >
      Not really, but here are two possibilities:
      >
      1. Try to enumerate the CrystalRuntime. Application object
      and see if anything has a name that sounds usable in
      your situation:
      >
      $crapp = new COM ("CrystalRuntim e.Application")
      or die ("Error on load");
      echo "<p>Enumera ting CrystalRuntime. Application object:</p>";
      $crapp->Reset();
      while ($e = $crapp->Next()) {
      echo "<p>$e</p>";
      }
      >
      Obviously, this is a development-time hack; you should
      put the code above into a separate script and delete the
      script when you no longer need it.
      >
      2. If all else fails, use $crapp->Release() to force unloading
      of the CrystalRuntime. Application object.
      >
      Cheers,
      NC

      Hi NC,

      Thanks for your post.

      I just upgraded to XAMPP as my PHP/Mysql package. It runs PHP5.1.6 and
      hey presto my problem disappeared..!! ...I can only think my older
      version of PHP wasn't doing it's COM cleanup very well....

      Cheers.....Mart yInOz

      Comment

      Working...