Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
PHPEMBED: we're not a module
Browse files Browse the repository at this point in the history
Summary: we only need to shutdown modules once, not once per instance since
the default (with us not being a module) is to shut down the ini stuff

Reviewed By: dreiss

Test Plan: I have four test scripts, two concurrent and one serial reentrent
and one serial regular and this passes them all




git-svn-id: svn+ssh://tubbs/svnroot/projects/phpembed/trunk@66760 2c7ba8d8-a2f7-0310-a573-de162e16dcc7
  • Loading branch information
boz committed Nov 1, 2007
1 parent d19114b commit c8aee78
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions src/php_cxx.cpp
Expand Up @@ -924,8 +924,7 @@ int php::php_set_ini_entry(char *entry, char *value, int stage)
php::~php() php::~php()
{ {
PUSH_CTX(); PUSH_CTX();
php_request_shutdown((void *) 0); php_request_shutdown(TSRMLS_C);
php_module_shutdown(TSRMLS_C);
POP_CTX(); POP_CTX();
#ifdef ZTS #ifdef ZTS
tsrm_mutex_free(lock); tsrm_mutex_free(lock);
Expand All @@ -934,6 +933,9 @@ php::~php()
p.clients--; p.clients--;
if(p.clients == 0 && p.initialized == true){ if(p.clients == 0 && p.initialized == true){
p.initialized = false; p.initialized = false;
p.message_function = p.error_function = p.output_function = NULL;
TSRMLS_FETCH();
php_module_shutdown(TSRMLS_C);
sapi_shutdown(); sapi_shutdown();
#ifdef ZTS #ifdef ZTS
tsrm_shutdown(); tsrm_shutdown();
Expand All @@ -959,7 +961,7 @@ php::php(bool _type_warnings)


PUSH_CTX(); PUSH_CTX();


/* Set some Embedded PHP defaults */ // Set some Embedded PHP defaults
zend_alter_ini_entry("html_errors", 12, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); zend_alter_ini_entry("html_errors", 12, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
zend_alter_ini_entry("implicit_flush", 15, "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); zend_alter_ini_entry("implicit_flush", 15, "1", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
zend_alter_ini_entry("max_execution_time", 19, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE); zend_alter_ini_entry("max_execution_time", 19, "0", 1, PHP_INI_SYSTEM, PHP_INI_STAGE_ACTIVATE);
Expand Down Expand Up @@ -987,6 +989,12 @@ php::php(bool _type_warnings)


int php::init_global_php(){ int php::init_global_php(){


// PHPE: lots of objects will use this one initialized php instance
p.clients++;
if(p.initialized == true)
return SUCCESS;
p.initialized = true;

// set up the callbacks // set up the callbacks
php_embed_module.sapi_error = error_wrap; php_embed_module.sapi_error = error_wrap;
php_embed_module.log_message = message_wrap; php_embed_module.log_message = message_wrap;
Expand All @@ -1003,12 +1011,6 @@ int php::init_global_php(){
void ***tsrm_ls; void ***tsrm_ls;
#endif #endif


// PHPE: lots of objects will use this one initialized php instance
p.clients++;
if(p.initialized == true)
return SUCCESS;
p.initialized = true;

#ifdef HAVE_SIGNAL_H #ifdef HAVE_SIGNAL_H
#if defined(SIGPIPE) && defined(SIG_IGN) #if defined(SIGPIPE) && defined(SIG_IGN)
signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE in standalone mode so signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE in standalone mode so
Expand All @@ -1021,10 +1023,10 @@ int php::init_global_php(){
#endif #endif


#ifdef PHP_WIN32 #ifdef PHP_WIN32
_fmode = _O_BINARY; /*sets default for file streams to binary */ _fmode = _O_BINARY; //sets default for file streams to binary
setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */ setmode(_fileno(stdin), O_BINARY); // make the stdio mode be binary
setmode(_fileno(stdout), O_BINARY); /* make the stdio mode be binary */ setmode(_fileno(stdout), O_BINARY); // make the stdio mode be binary
setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */ setmode(_fileno(stderr), O_BINARY); // make the stdio mode be binary
#endif #endif


#ifdef ZTS #ifdef ZTS
Expand Down

0 comments on commit c8aee78

Please sign in to comment.