which uses the following simple extension ------------------------- php_sample4.h ---------------------- #ifndef PHP_SAMPLE4_H /* Prevent double inclusion */ #define PHP_SAMPLE4_H /* Define Extension Properties */ #define PHP_SAMPLE4_EXTNAME "sample4" #define PHP_SAMPLE4_EXTVER "1.0" /* Import configure options when building outside of the PHP source tree */ #ifdef HAVE_CONFIG_H #include "config.h" #endif /* Include PHP Standard Header */ #include "php.h" /* Define the entry point symbol * Zend will use when loading this module */ extern zend_module_entry sample4_module_entry; #define phpext_sample4_ptr &sample4_module_entry PHP_MINIT_FUNCTION(sample4); PHP_MSHUTDOWN_FUNCTION(sample4); PHP_FUNCTION(sample4_hello_world); #endif /* PHP_SAMPLE4_H */ ------------------------- php_sample4.h ---------------------- ------------------------- php_sample4.c ---------------------- #include "php_sample4.h" #include "ext/standard/info.h" #include "main/sapi.h" #include "php_ini.h" ZEND_INI_MH(php_sample4_modify_greeting) { #ifdef ZTS THREAD_T thread = tsrm_thread_id(); #else void *thread = NULL; #endif if (new_value_length == 0 ) { return FAILURE; } php_printf("sample 4: thread %p greeting modified..new value is %s\n", thread, new_value); return SUCCESS; } PHP_INI_BEGIN() PHP_INI_ENTRY("sample4.greeting", "Hello World", PHP_INI_ALL, php_sample4_modify_greeting) PHP_INI_END() PHP_MINIT_FUNCTION(sample4) { #ifdef ZTS THREAD_T thread = tsrm_thread_id(); #else void *thread= NULL; #endif php_printf(">> sample 4: thread %p minit \n", thread); REGISTER_INI_ENTRIES(); php_printf("<< sample 4: thread %p minit \n", thread); return SUCCESS; } PHP_MSHUTDOWN_FUNCTION(sample4) { UNREGISTER_INI_ENTRIES(); return SUCCESS; } PHP_FUNCTION(sample4_hello_world) { const char *greeting = INI_STR("sample4.greeting"); php_printf("%s\n", greeting); } static function_entry php_sample4_functions[] = { PHP_FE(sample4_hello_world, NULL) { NULL, NULL, NULL } }; zend_module_entry sample4_module_entry = { #if ZEND_MODULE_API_NO >= 20010901 STANDARD_MODULE_HEADER, #endif PHP_SAMPLE4_EXTNAME, php_sample4_functions, PHP_MINIT(sample4), PHP_MSHUTDOWN(sample4), NULL, NULL, NULL, #if ZEND_MODULE_API_NO >= 20010901 PHP_SAMPLE4_EXTVER, #endif STANDARD_MODULE_PROPERTIES }; #ifdef COMPILE_DL_SAMPLE4 ZEND_GET_MODULE(sample4) #endif ------------------------- php_sample4.c ----------------------