Ejemplo n.º 1
0
static int
php_apache_server_startup(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
{
	void *data = NULL;
	const char *userdata_key = "apache2hook_post_config";

	/* Apache will load, unload and then reload a DSO module. This
	 * prevents us from starting PHP until the second load. */
	apr_pool_userdata_get(&data, userdata_key, s->process->pool);
	if (data == NULL) {
		/* We must use set() here and *not* setn(), otherwise the
		 * static string pointed to by userdata_key will be mapped
		 * to a different location when the DSO is reloaded and the
		 * pointers won't match, causing get() to return NULL when
		 * we expected it to return non-NULL. */
		apr_pool_userdata_set((const void *)1, userdata_key, apr_pool_cleanup_null, s->process->pool);
		return OK;
	}

	/* Set up our overridden path. */
	if (apache2_php_ini_path_override) {
		apache2_sapi_module.php_ini_path_override = apache2_php_ini_path_override;
	}
#ifdef ZTS
	tsrm_startup(1, 1, 0, NULL);
	(void)ts_resource(0);
	ZEND_TSRMLS_CACHE_UPDATE;
#endif
	sapi_startup(&apache2_sapi_module);
	apache2_sapi_module.startup(&apache2_sapi_module);
	apr_pool_cleanup_register(pconf, NULL, php_apache_server_shutdown, apr_pool_cleanup_null);
	php_apache_add_version(pconf);

	return OK;
}
Ejemplo n.º 2
0
static apr_status_t php_apache_child_shutdown(void *tmp)
{
	apache2_sapi_module.shutdown(&apache2_sapi_module);
#if defined(ZTS) && !defined(PHP_WIN32)
	tsrm_shutdown();
#endif
	return APR_SUCCESS;
}
Ejemplo n.º 3
0
static apr_status_t php_apache_server_shutdown(void *tmp)
{
	apache2_sapi_module.shutdown(&apache2_sapi_module);
	sapi_shutdown();
#ifdef ZTS
	tsrm_shutdown();
#endif
	return APR_SUCCESS;
}
Ejemplo n.º 4
0
int webjames_php_init(void)
/*called when WebJames initialises*/
{
	if (strcmp(configuration.webjames_h_revision,WEBJAMES_H_REVISION)!=0) {
		/*This file was compiled against a different revision of
		  webjames.h than webjames was, which could be bad news*/
		webjames_writelog(0,"PHP module is compiled for WebJames (%s) and was linked with a different version (%s)",WEBJAMES_H_REVISION,configuration.webjames_h_revision);
		return 0; /*failed to initialise*/
	}
	sapi_startup(&sapi_module);
	sapi_module.startup(&sapi_module);
	SG(server_context) = (void *) 1;
	return 1; /*initialised correctly*/
}
Ejemplo n.º 5
0
int phpFinit(lstTset * opt)
{
    php_core_globals *core_globals;

    tsrm_startup(128, 1, 0, NULL);
    core_globals = ts_resource(core_globals_id);

    logFmsg(0, "mod/php: PHP Interface v3 (module)");
    logFmsg(0, "mod/php: Copyright (c) 1999-2014 The PHP Group. All rights reserved.");

    sapi_startup(&capi_sapi_module);
    capi_sapi_module.startup(&capi_sapi_module);

    return STATUS_PROCEED;
}
Ejemplo n.º 6
0
void webjames_php_shutdown(void)
/*called when WebJames is about to quit*/
{
	sapi_module.shutdown(&sapi_module);
	sapi_shutdown();
}