internals:engine
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
internals:engine [2010/05/13 10:56] – added link to objects cataphract | internals:engine [2012/03/07 00:30] – [Extension Globals] cataphract | ||
---|---|---|---|
Line 49: | Line 49: | ||
[11:59am] scoates: and the hashtable will automatically grow on _add, right? the length passed to init is just a hint? | [11:59am] scoates: and the hashtable will automatically grow on _add, right? the length passed to init is just a hint? | ||
[11:59am] johannes_: right | [11:59am] johannes_: right | ||
- | |||
===== Unsorted ===== | ===== Unsorted ===== | ||
Add your random stuff here. I'll move it/update it/fix it (Derick) | Add your random stuff here. I'll move it/update it/fix it (Derick) | ||
+ | |||
+ | How to get %%__LINE__ and __FILE__%%? | ||
+ | * zend_get_executed_filename() and zend_get_executed_lineno() | ||
+ | |||
+ | How do I detect the SAPI? | ||
+ | * The fastest way [to detect CLI] would be: if (sapi_module.phpinfo_as_text) { ... } | ||
+ | * sapi_module is a true global, not a TSRM protected one | ||
+ | * sapi_module.name and sapi_module.pretty_name contain the name as char* | ||
+ | * sapi_module.phpinfo_as_text is a flag which can be set by different SAPIs to request text only phpinfo() output, currently only CLI and embed do that afaik, CGI does not. | ||
+ | |||
==== Extension Globals ===== | ==== Extension Globals ===== | ||
Line 105: | Line 114: | ||
</ | </ | ||
- | Note: do not use ZEND_INIT_MODULE_GLOBALS/ | + | Note: do not use ZEND_INIT_MODULE_GLOBALS/ |
- Now define the constructor and destructor functions: | - Now define the constructor and destructor functions: | ||
Line 120: | Line 129: | ||
} | } | ||
</ | </ | ||
+ | |||
+ | The globals constructor and destructor are NOT execute per-request, | ||
Note: ZEND_MODULE_GLOBALS_CTOR_D will declare a function as receiving a zend_extname_globals*, | Note: ZEND_MODULE_GLOBALS_CTOR_D will declare a function as receiving a zend_extname_globals*, |
internals/engine.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1