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


C++ php_request_startup函数代码示例

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


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

示例1: malloc

engine_context *context_new(php_engine *engine, void *parent) {
	engine_context *context;

	#ifdef ZTS
		void ***tsrm_ls = engine->tsrm_ls;
	#endif

	// Initialize context.
	context = (engine_context *) malloc((sizeof(engine_context)));
	if (context == NULL) {
		return_multi(NULL, 1);
	}

	context->engine = engine;
	context->parent = parent;

	SG(server_context) = (void *) context;

	// Initialize request lifecycle.
	if (php_request_startup(TSRMLS_C) == FAILURE) {
		SG(server_context) = NULL;
		free(context);

		return_multi(NULL, 1);
	}

	return_multi(context, 0);
}
开发者ID:deuill,项目名称:sigil,代码行数:28,代码来源:context.c

示例2: apache_php_module_main

/* {{{ apache_php_module_main
 */
int apache_php_module_main(request_rec *r, int display_source_mode)
{
	zend_file_handle file_handle;

	if (php_request_startup() == 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)){
			return OK;
		} else {
			return 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);
	}
	AP(in_request) = 0;

	return (OK);
}
开发者ID:chosen1,项目名称:php-src,代码行数:33,代码来源:sapi_apache.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_close

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

	if (!SG(sapi_started) && SUCCESS != php_request_startup(TSRMLS_C)) {
		return ret;
	}

	/* 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:KomaBeyond,项目名称:php-src,代码行数:33,代码来源:php_milter.c

示例5: 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

示例6: PQDBG_LVL_START

void *PlastiQThreadCreator::get_tsrmls_cache(QThread *thread)
{
    void *tsrmls_cache = threads.value(thread, Q_NULLPTR);

    //QThread *old_thread = this->thread();

    if(!tsrmls_cache) {
#ifdef PQDEBUG
        PQDBG_LVL_START(__FUNCTION__);
#endif
        //void *old_tsrmls_cache = tsrm_get_ls_cache();
        //this->moveToThread(thread);

        PQDBGLPUP("tsrm_new_interpreter_context");
        tsrmls_cache = tsrm_new_interpreter_context();

        //PQDBGLPUP("tsrm_set_interpreter_context");
        //tsrm_set_interpreter_context(tsrmls_cache);

        PQDBGLPUP("php_request_startup");
        php_request_startup();

        connect(thread, SIGNAL(destroyed(QObject*)), this, SLOT(free_tsrmls_cache(QObject*)));
        threads.insert(thread, tsrmls_cache);

        //this->moveToThread(old_thread);

        //PQDBGLPUP("tsrm_set_interpreter_context");
        //tsrm_set_interpreter_context(old_tsrmls_cache);

        PQDBG_LVL_DONE();
    }
开发者ID:wxmaper,项目名称:PQEngine,代码行数:32,代码来源:plastiqthreadcreator.cpp

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例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: php_apache_request_ctor

static void php_apache_request_ctor(ap_filter_t *f, php_struct *ctx)
{
	char *content_type;
	char *content_length;
	const char *auth;

	PG(during_request_startup) = 0;
	SG(sapi_headers).http_response_code = !f->r->status ? HTTP_OK : f->r->status;
	SG(request_info).content_type = apr_table_get(f->r->headers_in, "Content-Type");
#undef safe_strdup
#define safe_strdup(x) ((x)?strdup((x)):NULL)
	SG(request_info).query_string = safe_strdup(f->r->args);
	SG(request_info).request_method = f->r->method;
	SG(request_info).proto_num = f->r->proto_num;
	SG(request_info).request_uri = safe_strdup(f->r->uri);
	SG(request_info).path_translated = safe_strdup(f->r->filename);
	f->r->no_local_copy = 1;
	content_type = sapi_get_default_content_type();
	f->r->content_type = apr_pstrdup(f->r->pool, content_type);

	efree(content_type);

	content_length = (char *) apr_table_get(f->r->headers_in, "Content-Length");
	SG(request_info).content_length = (content_length ? atol(content_length) : 0);

	apr_table_unset(f->r->headers_out, "Content-Length");
	apr_table_unset(f->r->headers_out, "Last-Modified");
	apr_table_unset(f->r->headers_out, "Expires");
	apr_table_unset(f->r->headers_out, "ETag");

	auth = apr_table_get(f->r->headers_in, "Authorization");
	php_handle_auth_data(auth);

	if (SG(request_info).auth_user == NULL && f->r->user) {
		SG(request_info).auth_user = estrdup(f->r->user);
	}

	ctx->r->user = apr_pstrdup(ctx->r->pool, SG(request_info).auth_user);

	php_request_startup();
}
开发者ID:chosen1,项目名称:php-src,代码行数:41,代码来源:sapi_apache2.c

示例14: php_apache_request_ctor

static int php_apache_request_ctor(request_rec *r, php_struct *ctx)
{
	char *content_length;
	const char *auth;

	SG(sapi_headers).http_response_code = !r->status ? HTTP_OK : r->status;
	SG(request_info).content_type = apr_table_get(r->headers_in, "Content-Type");
	SG(request_info).query_string = apr_pstrdup(r->pool, r->args);
	SG(request_info).request_method = r->method;
	SG(request_info).proto_num = r->proto_num;
	SG(request_info).request_uri = apr_pstrdup(r->pool, r->uri);
	SG(request_info).path_translated = apr_pstrdup(r->pool, r->filename);
	r->no_local_copy = 1;

	content_length = (char *) apr_table_get(r->headers_in, "Content-Length");
	if (content_length) {
		ZEND_ATOL(SG(request_info).content_length, content_length);
	} else {
		SG(request_info).content_length = 0;
	}

	apr_table_unset(r->headers_out, "Content-Length");
	apr_table_unset(r->headers_out, "Last-Modified");
	apr_table_unset(r->headers_out, "Expires");
	apr_table_unset(r->headers_out, "ETag");

	auth = apr_table_get(r->headers_in, "Authorization");
	php_handle_auth_data(auth);

	if (SG(request_info).auth_user == NULL && r->user) {
		SG(request_info).auth_user = estrdup(r->user);
	}

	ctx->r->user = apr_pstrdup(ctx->r->pool, SG(request_info).auth_user);

	return php_request_startup();
}
开发者ID:SammyK,项目名称:php-src,代码行数:37,代码来源:sapi_apache2.c

示例15: 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


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