Search code examples
phpiiscomtypelib

php com_load_typelib working only the first time


Hey, I am using PHP 5.3 on IIS 7 (express) and planning to work with COM object. Everythings seems to work fine at first, I have an example, say like:

com_load_typelib("Insert.gt");
$gt = new COM("Insert.gt");
$gt = NULL;

I've limited it to what's essential. The problem is, com_load_typelib loads constants from COM object only first time I try it... it still does return true on next refresh, however the constants are no longer present. I have also tried omitting it, and enabling com.autoregister_typelib, but it still only works the first time I try.

The interesting thing is, it is sufficient to kill php-cgi process, and the next time I'll try, it'll work again for one time.

Am I missing something? Do I omit some realease methods?

I believe that the COM I use does not have any method for quitting.


Solution

  • I did not manage to fix the problem. Just so it will not be left open, I have overcome this using

      var_export(get_defined_constants())
    

    when it worked and then converted it to define("name", value) format using few easy find & replaces on the selection.

    The problem is when you want to be able to work on few different versions that have different constants - I found no solution for that.