当前位置: 首页>>代码示例>>C++>>正文


C++ php_request_shutdown函数代码示例

本文整理汇总了C++中php_request_shutdown函数的典型用法代码示例。如果您正苦于以下问题:C++ php_request_shutdown函数的具体用法?C++ php_request_shutdown怎么用?C++ php_request_shutdown使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了php_request_shutdown函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mlfi_init

/* {{{ Init Milter
*/
static int mlfi_init()
{
	int ret = 0;
	zend_file_handle file_handle;
	zval function_name, retval;
	int status;
	TSRMLS_FETCH();

	/* request startup */
	if (php_request_startup(TSRMLS_C)==FAILURE) {
		SG(headers_sent) = 1;
		SG(request_info).no_headers = 1;
		php_request_shutdown((void *) 0);

		return -1;
	}
	
	/* disable headers */
	SG(headers_sent) = 1;
	SG(request_info).no_headers = 1;
	 
	if (filename == NULL) {
		php_printf("No input file specified");
		return SMFIS_TEMPFAIL;
	}

	if (!(file_handle.handle.fp = VCWD_FOPEN(filename, "rb"))) {
		php_printf("Could not open input file: %s\n", filename);
		return SMFIS_TEMPFAIL;
	}

	file_handle.type = ZEND_HANDLE_FP;
	file_handle.filename = filename;
	file_handle.free_filename = 0;
	file_handle.opened_path = NULL;

	php_execute_script(&file_handle TSRMLS_CC);
	
	/* call userland */
	INIT_ZVAL(function_name);

	ZVAL_STRING(&function_name, "milter_init", 0);

	/* set the milter context for possible use in API functions */
	MG(state) = MLFI_INIT;

	status = call_user_function(CG(function_table), NULL, &function_name, &retval, 0, NULL TSRMLS_CC);

	MG(state) = MLFI_NONE;
	MG(initialized) = 1;

	if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) {
		ret = Z_LVAL(retval);
	}
	
	php_request_shutdown((void *) 0);
	
	return ret;
}
开发者ID:do-aki,项目名称:petipeti,代码行数:61,代码来源:php_milter.c

示例2: webjames_php_close

static void webjames_php_close(struct connection *conn, int force)
/*called by webjames if it wants to close the connection*/
{

	php_request_shutdown(NULL);
	WG(oldclose)(conn,force);
}
开发者ID:chosen1,项目名称:php-src,代码行数:7,代码来源:webjames.c

示例3: lsapi_module_main

static int lsapi_module_main(int show_source)
{
    zend_file_handle file_handle = {0};

    if (php_request_startup() == FAILURE ) {
        return -1;
    }
    
    if (parse_user_ini && lsapi_activate_user_ini() == FAILURE) {
        return -1;
    }

    if (show_source) {
        zend_syntax_highlighter_ini syntax_highlighter_ini;

        php_get_highlight_struct(&syntax_highlighter_ini);
        highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini);
    } else {
        lsapi_execute_script( &file_handle);
    }
    zend_try {
        php_request_shutdown(NULL);
        memset( argv0, 0, 46 );
    } zend_end_try();
    return 0;
}
开发者ID:stamhe,项目名称:php-src,代码行数:26,代码来源:lsapi_main.c

示例4: mlfi_connect

/* {{{ mlfi_connect()
*/
static sfsistat	mlfi_connect(SMFICTX *ctx, char *hostname, _SOCK_ADDR *hostaddr)
{
	zend_file_handle file_handle;
	zval function_name, retval, *param[1];
	int status;
	TSRMLS_FETCH();

	/* request startup */
	if (php_request_startup(TSRMLS_C)==FAILURE) {
		SG(headers_sent) = 1;
		SG(request_info).no_headers = 1;
		php_request_shutdown((void *) 0);

		return SMFIS_TEMPFAIL;
	}
	
	/* disable headers */
	SG(headers_sent) = 1;
	SG(request_info).no_headers = 1;
	
	if (filename == NULL) {
		php_printf("No input file specified");
		return SMFIS_TEMPFAIL;
	}
	
	if (!(file_handle.handle.fp = VCWD_FOPEN(filename, "rb"))) {
		php_printf("Could not open input file: %s\n", filename);
		return SMFIS_TEMPFAIL;
	}

	file_handle.type = ZEND_HANDLE_FP;
	file_handle.filename = filename;
	file_handle.free_filename = 0;
	file_handle.opened_path = NULL;

	php_execute_script(&file_handle TSRMLS_CC);
	
	/* call userland */
	INIT_ZVAL(function_name);

	ALLOC_ZVAL(param[0]);
	INIT_PZVAL(param[0]);

	ZVAL_STRING(&function_name, "milter_connect", 0);
	ZVAL_STRING(param[0], hostname, 1);

	/* set the milter context for possible use in API functions */
	MG(ctx) = ctx;
	MG(state) = MLFI_CONNECT;

	status = call_user_function(CG(function_table), NULL, &function_name, &retval, 1, param TSRMLS_CC);

	MG(state) = MLFI_NONE;
	zval_ptr_dtor(param);
	if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) {
		return Z_LVAL(retval);
	}
	
	return SMFIS_CONTINUE;
}
开发者ID:do-aki,项目名称:petipeti,代码行数:62,代码来源:php_milter.c

示例5: mlfi_close

/* {{{ mlfi_close()
*/
static sfsistat mlfi_close(SMFICTX *ctx)
{
	int ret = SMFIS_CONTINUE;
	zval function_name, retval;
	int status;
	TSRMLS_FETCH();

	/* call userland */
	INIT_ZVAL(function_name);
	ZVAL_STRING(&function_name, "milter_close", 0);
	
	/* set the milter context for possible use in API functions */
	MG(ctx) = ctx;
	MG(state) = MLFI_CLOSE;
	
	status = call_user_function(CG(function_table), NULL, &function_name, &retval, 0, NULL TSRMLS_CC);

	MG(state) = MLFI_NONE;
	
	if (status == SUCCESS && Z_TYPE(retval) == IS_LONG) {
		ret = Z_LVAL(retval);
	}
	
	php_request_shutdown((void *) 0);

	return ret;
}
开发者ID:do-aki,项目名称:petipeti,代码行数:29,代码来源:php_milter.c

示例6: exec_php

/**
* Gets the contents of the BLOB b and offers it to Zend for parsing/execution
*/
void exec_php(BLOBCALLBACK b, PARAMDSC *res, ISC_SHORT *init)
{
	int result, remaining = b->blob_total_length, i = 0;
	char *code = pemalloc(remaining+1, 1);
	ISC_USHORT read;

	for (code[remaining] = '\0'; remaining > 0; remaining -= read)
		b->blob_get_segment(b->blob_handle, &code[i++<<16],min(0x10000,remaining), &read); 

	LOCK();

	switch (init && *init) {

		default:
#ifdef PHP_EMBED
			php_request_shutdown(NULL);
			if (FAILURE == (result = php_request_startup(TSRMLS_C))) {
				break;
			}
		case 0:
#endif
			/* feed it to the parser */
			zend_first_try {
				result = zend_eval_stringl(code, b->blob_total_length, NULL, "Firebird Embedded PHP engine" TSRMLS_CC);
			} zend_end_try();
	}
	
	UNLOCK();

	free(code);

	res->dsc_dtype = dtype_long;
	*(ISC_LONG*)res->dsc_address = (result == SUCCESS);
}
开发者ID:1HLtd,项目名称:php-src,代码行数:37,代码来源:php_ibase_udf.c

示例7: webjames_module_main

static void webjames_module_main(void)
{
	zend_file_handle file_handle;
	FILE *fp=NULL;
	char *path;

	/* Convert filename to Unix format*/
	__riscosify_control|=__RISCOSIFY_STRICT_UNIX_SPECS;
	path = __unixify(WG(conn)->filename,0,NULL,1024,0);
	if (path) SG(request_info).path_translated = estrdup(path);

	SG(request_info).query_string = WG(conn)->args;
	SG(request_info).request_uri = WG(conn)->requesturi;
	SG(request_info).request_method = WG(conn)->methodstr;
	if (WG(conn)->method==METHOD_HEAD) {
		SG(request_info).headers_only = 1;
	} else {
		SG(request_info).headers_only = 0;
	}
	SG(sapi_headers).http_response_code = 200;
	SG(request_info).content_type = WG(conn)->type;
	SG(request_info).content_length = WG(conn)->bodysize;

	SG(request_info).auth_user = NULL;
	SG(request_info).auth_password = NULL;
	if (WG(conn)->authorization) {
		char *colon=strchr(WG(conn)->authorization,':');
		if (colon) {
			SG(request_info).auth_user = emalloc(colon-WG(conn)->authorization+1);
			if (SG(request_info).auth_user) {
				memcpy(SG(request_info).auth_user,WG(conn)->authorization,colon-WG(conn)->authorization);
				SG(request_info).auth_user[colon-WG(conn)->authorization]='\0';
				SG(request_info).auth_password = estrdup(colon+1);
			}
		}
	}

	/*ensure that syslog calls get logged separately from WebJames' main log */
	openlog("PHP",0,0);

	file_handle.type = ZEND_HANDLE_FILENAME;
	file_handle.filename = SG(request_info).path_translated;
	file_handle.free_filename = 0;
	file_handle.opened_path = NULL;

	if (php_request_startup() == FAILURE) {
		return;
	}

	php_execute_script(&file_handle);
	php_request_shutdown(NULL);
}
开发者ID:chosen1,项目名称:php-src,代码行数:52,代码来源:webjames.c

示例8: php_embed_shutdown

EMBED_SAPI_API void php_embed_shutdown(void)
{
	php_request_shutdown((void *) 0);
	php_module_shutdown();
	sapi_shutdown();
#ifdef ZTS
    tsrm_shutdown();
#endif
	if (php_embed_module.ini_entries) {
		free(php_embed_module.ini_entries);
		php_embed_module.ini_entries = NULL;
	}
}
开发者ID:CooCoooo,项目名称:php-src,代码行数:13,代码来源:php_embed.c

示例9: capi_module_main

int capi_module_main(NSLS_D)
{
    zend_file_handle file_handle;

    if (php_request_startup() == FAILURE) {
        return FAILURE;
    }
    file_handle.type = ZEND_HANDLE_FILENAME;
    file_handle.filename = SG(request_info).path_translated;
    file_handle.free_filename = 0;
    file_handle.opened_path = NULL;

    php_execute_script(&file_handle);
    php_request_shutdown(NULL);

    return SUCCESS;
}
开发者ID:slusarz,项目名称:php-src,代码行数:17,代码来源:capi.c

示例10: php_apache_request_dtor

static void php_apache_request_dtor(ap_filter_t *f)
{
	php_apr_bucket_brigade *pbb = (php_apr_bucket_brigade *)f->ctx;

	php_request_shutdown(NULL);

	if (SG(request_info).query_string) {
		free(SG(request_info).query_string);
	}
	if (SG(request_info).request_uri) {
		free(SG(request_info).request_uri);
	}
	if (SG(request_info).path_translated) {
		free(SG(request_info).path_translated);
	}

	apr_brigade_destroy(pbb->bb);
}
开发者ID:chosen1,项目名称:php-src,代码行数:18,代码来源:sapi_apache2.c

示例11: execPhpScript

int
execPhpScript( char *scrFile, int scrArgc, char **scrArgv ) {
    zend_file_handle file_handle;
    int status = 0;
    int lineno = 0;

    if ( ( status = php_seek_file_begin( &file_handle, scrFile, &lineno TSRMLS_CC ) )
            < 0 ) {
        rodsLog( LOG_ERROR,
                 "execPhpScript: php_seek_file_begin error for %s", scrFile );
        return status;
    }

    file_handle.type = ZEND_HANDLE_FP;
    file_handle.opened_path = NULL;
    file_handle.free_filename = 0;
    SG( request_info ).argc = scrArgc;

    SG( request_info ).path_translated = file_handle.filename;
    SG( request_info ).argv = scrArgv;

    if ( php_request_startup( TSRMLS_C ) == FAILURE ) {
        rodsLog( LOG_ERROR,
                 "execPhpScript: php_request_startup error for %s", scrFile );
        fclose( file_handle.handle.fp );
        return PHP_REQUEST_STARTUP_ERR;
    }
    CG( start_lineno ) = lineno;
    zend_is_auto_global( "_SERVER", sizeof( "_SERVER" ) - 1 TSRMLS_CC );
    PG( during_request_startup ) = 0;
    php_execute_script( &file_handle TSRMLS_CC );
    status = EG( exit_status );

    if ( status != SUCCESS ) {
        rodsLog( LOG_ERROR,
                 "execPhpScript: php_execute_script error for %s", scrFile );
        status = PHP_EXEC_SCRIPT_ERR;
    }

    php_request_shutdown( ( void * ) 0 );

    return status;
}
开发者ID:bpow,项目名称:irods,代码行数:43,代码来源:phptest.cpp

示例12: php_ns_module_main

static int
php_ns_module_main(void)
{
	zend_file_handle file_handle;

	file_handle.type = ZEND_HANDLE_FILENAME;
	file_handle.filename = SG(request_info).path_translated;
	file_handle.free_filename = 0;
	file_handle.opened_path = NULL;
	
	php_ns_config(global_context, 0);
	if (php_request_startup() == FAILURE) {
		return NS_ERROR;
	}
	
	php_execute_script(&file_handle);
	php_request_shutdown(NULL);

	return NS_OK;
}
开发者ID:AmesianX,项目名称:php-src,代码行数:20,代码来源:aolserver.c

示例13: apache_php_module_main

/* {{{ apache_php_module_main
 */
int apache_php_module_main(request_rec *r, int display_source_mode TSRMLS_DC)
{
	int retval = OK;	
	zend_file_handle file_handle;

	if (php_request_startup(TSRMLS_C) == FAILURE) {
		return FAILURE;
	}
	/* sending a file handle to another dll is not working
	   so let zend open it. */
	
	if (display_source_mode) {
		zend_syntax_highlighter_ini syntax_highlighter_ini;

		php_get_highlight_struct(&syntax_highlighter_ini);
		if (highlight_file(SG(request_info).path_translated, &syntax_highlighter_ini TSRMLS_CC) != SUCCESS) {
			retval = NOT_FOUND;
		}
	} else {
		file_handle.type = ZEND_HANDLE_FILENAME;
		file_handle.handle.fd = 0;
		file_handle.filename = SG(request_info).path_translated;
		file_handle.opened_path = NULL;
		file_handle.free_filename = 0;

		(void) php_execute_script(&file_handle TSRMLS_CC);
	}

	AP(in_request) = 0;
	
	zend_try {
		php_request_shutdown(NULL);
	} zend_end_try();
	
	return retval;
}
开发者ID:austintgriffith,项目名称:php7,代码行数:38,代码来源:sapi_apache.c

示例14: TSRMLS_FETCH

int MaPhp4Handler::run(MaRequest *rq)
{
	MaDataStream		*dynBuf;
	MprHashTable		*env;
	MprStringHashEntry	*vp;
	int					flags, contentLength;

	hitCount++;

	flags= rq->getFlags();
	dynBuf = rq->getDynBuf();
	rq->insertDataStream(dynBuf);
	rq->setResponseCode(200);
	rq->setHeaderFlags(MPR_HTTP_DONT_CACHE);
	rq->setPullPost();

	//
	//	Initialize PHP
	//
 	TSRMLS_FETCH();

	zend_first_try {
		phpInitialized = 0;
		func_data = rq;
		var_array = 0;

		SG(server_context) = rq;
		SG(request_info).path_translated = rq->getFileName();
		SG(request_info).request_method = rq->getMethod();
		SG(request_info).request_uri = rq->getUri();
		SG(request_info).query_string = rq->getQueryString();
		SG(request_info).content_type = rq->getRequestContentMimeType();
		SG(request_info).content_length = rq->getContentLength();
		SG(sapi_headers).http_response_code = 200;
		SG(request_info).auth_user = rq->getUser();
		SG(request_info).auth_password = rq->getPassword();

		php_request_startup(TSRMLS_C);
		CG(zend_lineno) = 0;

	} zend_catch {

		mprLog(1, log, "PHP startup failed\n");
		zend_try {
			php_request_shutdown(0);
		} zend_end_try();
		rq->requestError(MPR_HTTP_INTERNAL_SERVER_ERROR, 
			"PHP initialization failed");
		return MPR_HTTP_HANDLER_FINISHED_PROCESSING;

	} zend_end_try();

	phpInitialized = 1;
	
	//
	//	Copy the environment variables to the PHP script engine
	//
	env = rq->getEnv();
	vp = (MprStringHashEntry*) env->getFirst();
	while (vp) {
		php_register_variable(vp->getKey(), vp->getValue(), 
			var_array TSRMLS_CC);
		vp = (MprStringHashEntry*) env->getNext(vp);
	}


	//
	//	Execute the PHP script
	//
	if (execScript(rq) < 0) {
		zend_try {
			php_request_shutdown(0);
		} zend_end_try();

		rq->requestError(MPR_HTTP_INTERNAL_SERVER_ERROR, 
			"PHP script execution failed");
		return MPR_HTTP_HANDLER_FINISHED_PROCESSING;
	}
开发者ID:OPSF,项目名称:uClinux,代码行数:78,代码来源:php4Handler.cpp

示例15: ts_resource_ex

int32_t ScriptEngine::executeWebRequest(const std::string& path, BaseLib::HTTP& request, std::shared_ptr<BaseLib::Rpc::ServerInfo::Info>& serverInfo, std::shared_ptr<BaseLib::SocketOperations>& socket)
{
	if(_disposing) return 1;
	if(!GD::bl->io.fileExists(path))
	{
		GD::out.printError("Error: PHP script \"" + path + "\" does not exist.");
		return -1;
	}
	ts_resource_ex(0, NULL); //Replaces TSRMLS_FETCH()
	try
	{
		zend_file_handle script;

		script.type = ZEND_HANDLE_FILENAME;
		script.filename = path.c_str();
		script.opened_path = NULL;
		script.free_filename = 0;

		zend_homegear_globals* globals = php_homegear_get_globals();
		if(!globals)
		{
			ts_free_thread();
			return -1;
		}
		globals->socket = socket.get();
		globals->http = &request;

		if(!tsrm_get_ls_cache())
		{
			GD::out.printCritical("Critical: Error in PHP: No thread safe resource exists (1).");
			ts_free_thread();
			return -1;
		}
		if(!((sapi_globals_struct *) (*((void ***) tsrm_get_ls_cache()))[((sapi_globals_id)-1)]))
		{
			GD::out.printCritical("Critical: Error in PHP: No thread safe resource exists (2).");
			ts_free_thread();
			return -1;
		}
		SG(server_context) = (void*)serverInfo.get(); //Must be defined! Otherwise POST data is not processed.
		SG(sapi_headers).http_response_code = 200;
		SG(default_mimetype) = nullptr;
		SG(default_charset) = nullptr;
		SG(request_info).content_length = request.getHeader()->contentLength;
		if(!request.getHeader()->contentType.empty()) SG(request_info).content_type = request.getHeader()->contentType.c_str();
		SG(request_info).request_method = request.getHeader()->method.c_str();
		SG(request_info).proto_num = request.getHeader()->protocol == BaseLib::HTTP::Protocol::http10 ? 1000 : 1001;
		std::string uri = request.getHeader()->path + request.getHeader()->pathInfo;
		if(!request.getHeader()->args.empty()) uri.append('?' + request.getHeader()->args);
		if(!request.getHeader()->args.empty()) SG(request_info).query_string = estrndup(&request.getHeader()->args.at(0), request.getHeader()->args.size());
		if(!uri.empty()) SG(request_info).request_uri = estrndup(&uri.at(0), uri.size());
		std::string pathTranslated = serverInfo->contentPath.substr(0, serverInfo->contentPath.size() - 1) + request.getHeader()->pathInfo;
		SG(request_info).path_translated = estrndup(&pathTranslated.at(0), pathTranslated.size());

		if (php_request_startup() == FAILURE) {
			GD::bl->out.printError("Error calling php_request_startup...");
			ts_free_thread();
			return 1;
		}

		php_execute_script(&script);

		int32_t exitCode = EG(exit_status);

		if(SG(request_info).query_string)
		{
			efree(SG(request_info).query_string);
			SG(request_info).query_string = nullptr;
		}
		if(SG(request_info).request_uri)
		{
			efree(SG(request_info).request_uri);
			SG(request_info).request_uri = nullptr;
		}
		if(SG(request_info).path_translated)
		{
			efree(SG(request_info).path_translated);
			SG(request_info).path_translated = nullptr;
		}

		php_request_shutdown(NULL);

		ts_free_thread();
		return exitCode;
	}
	catch(const std::exception& ex)
	{
		GD::bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
	}
	catch(BaseLib::Exception& ex)
	{
		GD::bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
	}
	catch(...)
	{
		GD::bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
	}
	std::string error("Error executing script. Check Homegear log for more details.");
	if(socket) php_homegear_write_socket(socket.get(), error.c_str(), error.length());
	if(SG(request_info).query_string)
//.........这里部分代码省略.........
开发者ID:pauxus,项目名称:Homegear,代码行数:101,代码来源:ScriptEngine.cpp


注:本文中的php_request_shutdown函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。