Hi,

I've just started creating my own PHP extension and am having some trouble
understanding the ZEND_MODULE_STARTUP and ZEND_MODULE_SHUTDOWN functions.

my zend_module_entry is as follows:

zend_module_entry tpphp_module_entry = {
 STANDARD_MODULE_HEADER,
 "tpphp",
 tpphp_functions,
 ZEND_MODULE_STARTUP_N(tpphp),
 ZEND_MODULE_SHUTDOWN_N(tpphp),
 ZEND_MODULE_ACTIVATE_N(tpphp),
 ZEND_MODULE_DEACTIVATE_N(tpphp),
 ZEND_MODULE_INFO_N(tpphp),
 NO_VERSION_YET,
 STANDARD_MODULE_PROPERTIES
};

and then I have the two module functions defined as:

ZEND_MODULE_STARTUP_D(tpphp)
{
 FILE *fp;

 fp =fopen("d:/moduleinit.txt", "w+");
 if (fp)
  fclose(fp);

 return SUCCESS;
}

ZEND_MODULE_SHUTDOWN_D(tpphp)
{
 FILE *fp;

 fp =fopen("d:/moduleshutdown.txt", "w+");
 if (fp)
  fclose(fp);

 return SUCCESS;
}

the file functions are just so I can see when they're being called and are
only temporary.

I'm running php 4.1.1 as an apache module (1.3.20) (on NT4 workstation) and
am loading the extension via the php.ini file.

Now the problem is when I start apache (net start apache) php seems to call
the module startup function and then it calls the module shutdown function
immediately afterwards.  The request startup and shutdown functions seem to
work as expected, i.e. they get called when I make a request to apache.

If I then stop apache (net stop apache) the module shutdown function gets
called as expected.  It's just when starting that the problem occurs.  Is
this the expected behaviour and if so is there anyway of telling in the
module shutdown function if the module really is shutting down or have I
done something completely wrong?

TIA

Pete




-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to