{"id":315,"date":"2005-10-25T12:40:41","date_gmt":"2005-10-25T00:40:41","guid":{"rendered":""},"modified":"2005-10-25T12:40:41","modified_gmt":"2005-10-25T00:40:41","slug":"","status":"publish","type":"post","link":"https:\/\/www.mudone.com\/?p=315","title":{"rendered":"\u89e3\u5bc6ZEND\u52a0\u5bc6\u540e\u7684PHP"},"content":{"rendered":"<p>ps:\u672c\u4eba\u8fd8\u6ca1\u6709\u6d4b\u8bd5\u8fc7\uff0c\u65b9\u6cd5\u4ec5\u4f9b\u53c2\u8003\uff0e\u6b64\u65b9\u6cd5\u53ea\u4f5c\u4e3a\u5b66\u4e60\u4e4b\u7528\uff0c\u8bf7\u52ff\u4f5c\u5176\u4ed6\u7528\u9014\uff0e<br \/>\n\u5148\u4e0b\u8f7d\uff1a vld-0.8.0 <\/p>\n<p>\u4e0b\u8f7d\u5730\u5740\u3000<a href=\"http:\/\/www.huanle.net\/down\/vld.php\" title=\"http:\/\/www.huanle.net\/down\/vld.php\" target=\"_blank\">http:\/\/www.huanle.net\/down\/vld.php<\/a><\/p>\n<p>\u6267\u884c<\/p>\n<div class=\"quote\">\n<div class=\"quote-title\">\u5f15\u7528\u81ea <u><\/u><\/div>\n<div class=\"quote-content\">#tar -xzf vld-0.8.0.tgz \/\/\u89e3\u538b<br \/>\n#mv vld-0.8.0 vld \/\/\u91cd\u547d\u540d<br \/>\n#cd -R vld ..\/php-4.3.8\/ext \/\/\u62f7\u8d1dvld\u76ee\u5f55\u5230php\u7684\u89e3\u538b\u76ee\u5f55\u4e0b\u7684ext\u4e2d<br \/>\n#cd php-4.3.8<br \/>\n#rm configure \/\/\u5220\u9664configure,\u56e0\u4e3a\u4e0b\u9762\u7684buildconf\u4f1a\u91cd\u65b0\u751f\u6210\u65b0\u7684configure<br \/>\n#.\/buildconf \/\/\u5982\u679c\u51fa\u73b0\u9519\u8bef,\u5c31\u6309\u63d0\u793a\u52a0\u4e0a\u76f8\u5e94\u7684\u53c2\u6570.<br \/>\n#.\/configure &#8211;with-mysql &#8211;with-apxs2=\/usr\/www\/bin\/apxs &#8211;enable-vld \u91cd\u65b0\u68c0\u67e5php<\/div>\n<\/div>\n<p><!--more-->#make \u7f16\u8bd1<br \/>\n#make install \u5b89\u88c5[\/quote]\u670d\u52a1\u5668\u5fc5\u987b\u5148\u5b89\u88c5ZendOptimizer<br \/>\n\u8fd0\u884cZend\u540e\u7684\u6587\u4ef6,\u67e5\u770b\u6e90\u4ee3\u7801\u5c31\u53ef\u4ee5\u770b\u5230\u4e86.<\/p>\n<p>\u65b9\u6cd5\u4e8c\uff1a<br \/>\n\u53ea\u8981\u4f60\u6709\uff4c\uff49\uff4e\uff55\uff58\u4e3b\u6a5f\uff0c\u518d\u88dd\u4e00\u500b\u7a0b\u5e8f\uff0c\u5c31\u80fd\u700f\u89bd\u6e90\u78bc\u4e86\uff0e<\/p>\n<div class=\"quote\">\n<div class=\"quote-title\">\u5f15\u7528\u81ea <u><\/u><\/div>\n<div class=\"quote-content\">#ifdef HAVE_CONFIG_H<br \/>\n#include &quot;config.h&quot;<br \/>\n#endif<\/p>\n<p>#include &quot;php.h&quot;<br \/>\n#include &quot;php_ini.h&quot;<br \/>\n#include &quot;ext\/standard\/info.h&quot;<br \/>\n#include &quot;php_vld.h&quot;<br \/>\n#include &quot;srm_oparray.h&quot;<\/p>\n<p>static zend_op_array* (*old_compile_file)(zend_file_handle* file_handle, int type TSRMLS_DC);<br \/>\nstatic zend_op_array* vld_compile_file(zend_file_handle*, int TSRMLS_DC);<\/p>\n<p>static void (*old_execute)(zend_op_array *op_array TSRMLS_DC);<br \/>\nstatic void vld_execute(zend_op_array *op_array TSRMLS_DC);<\/p>\n<p>function_entry vld_functions[] = {<br \/>\n{NULL, NULL, NULL}<br \/>\n};<\/p>\n<p>zend_module_entry vld_module_entry = {<br \/>\n#if ZEND_MODULE_API_NO &gt;= 20010901<br \/>\nSTANDARD_MODULE_HEADER,<br \/>\n#endif<br \/>\n&quot;vld&quot;,<br \/>\nvld_functions,<br \/>\nPHP_MINIT(vld),<br \/>\nPHP_MSHUTDOWN(vld),<br \/>\nPHP_RINIT(vld),<br \/>\nPHP_RSHUTDOWN(vld),<br \/>\nPHP_MINFO(vld),<br \/>\n#if ZEND_MODULE_API_NO &gt;= 20010901<br \/>\n&quot;0.8.0&quot;,<br \/>\n#endif<br \/>\nSTANDARD_MODULE_PROPERTIES<br \/>\n};<\/p>\n<p>#ifdef COMPILE_DL_VLD<br \/>\nZEND_GET_MODULE(vld)<br \/>\n#endif<\/p>\n<p>ZEND_BEGIN_MODULE_GLOBALS(vld)<br \/>\nint active;<br \/>\nint skip_prepend;<br \/>\nint skip_append;<br \/>\nint execute;<br \/>\nZEND_END_MODULE_GLOBALS(vld)<\/p>\n<p>ZEND_DECLARE_MODULE_GLOBALS(vld)<\/p>\n<p>#ifdef ZTS<br \/>\n#define VLD_G(v) TSRMG(vld_globals_id, zend_vld_globals *, v)<br \/>\n#else<br \/>\n#define VLD_G(v) (vld_globals.v)<br \/>\n#endif<\/p>\n<p>PHP_INI_BEGIN()<br \/>\nSTD_PHP_INI_ENTRY(&quot;vld.active&quot;, &quot;0&quot;, PHP_INI_SYSTEM, OnUpdateBool, active, zend_vld_globals, vld_globals)<br \/>\nSTD_PHP_INI_ENTRY(&quot;vld.skip_prepend&quot;, &quot;0&quot;, PHP_INI_SYSTEM, OnUpdateBool, skip_prepend, zend_vld_globals, vld_globals)<br \/>\nSTD_PHP_INI_ENTRY(&quot;vld.skip_append&quot;, &quot;0&quot;, PHP_INI_SYSTEM, OnUpdateBool, skip_append, zend_vld_globals, vld_globals)<br \/>\nSTD_PHP_INI_ENTRY(&quot;vld.execute&quot;, &quot;1&quot;, PHP_INI_SYSTEM, OnUpdateBool, execute, zend_vld_globals, vld_globals)<br \/>\nPHP_INI_END()<\/p>\n<p>static void vld_init_globals(zend_vld_globals *vld_globals)<br \/>\n{<br \/>\nvld_globals-&gt;active = 0;<br \/>\nvld_globals-&gt;skip_prepend = 0;<br \/>\nvld_globals-&gt;skip_append = 0;<br \/>\nvld_globals-&gt;execute = 1;<br \/>\n}<\/p>\n<p>PHP_MINIT_FUNCTION(vld)<br \/>\n{<br \/>\nZEND_INIT_MODULE_GLOBALS(vld, vld_init_globals, NULL);<br \/>\nREGISTER_INI_ENTRIES();<br \/>\nold_compile_file = zend_compile_file;<br \/>\nold_execute = zend_execute;<\/p>\n<p>return SUCCESS;<br \/>\n}<\/p>\n<p>PHP_MSHUTDOWN_FUNCTION(vld)<br \/>\n{<br \/>\nUNREGISTER_INI_ENTRIES();<\/p>\n<p>zend_compile_file = old_compile_file;<br \/>\nzend_execute = old_execute;<\/p>\n<p>return SUCCESS;<br \/>\n}<\/p>\n<p>PHP_RINIT_FUNCTION(vld)<br \/>\n{<br \/>\nif (VLD_G(active)) {<br \/>\nzend_compile_file = vld_compile_file;<br \/>\nif (!VLD_G(execute)) {<br \/>\nzend_execute = vld_execute;<br \/>\n}<br \/>\n}<br \/>\nreturn SUCCESS;<br \/>\n}<\/p>\n<p>PHP_RSHUTDOWN_FUNCTION(vld)<br \/>\n{<br \/>\nzend_compile_file = old_compile_file;<br \/>\nzend_execute = old_execute;<\/p>\n<p>return SUCCESS;<br \/>\n}<\/p>\n<p>PHP_MINFO_FUNCTION(vld)<br \/>\n{<br \/>\nphp_info_print_table_start();<br \/>\nphp_info_print_table_header(2, &quot;vld support&quot;, &quot;enabled&quot;);<br \/>\nphp_info_print_table_end();<\/p>\n<p>}<\/p>\n<p>static int vld_check_fe (zend_op_array *fe, zend_bool *have_fe TSRMLS_DC)<br \/>\n{<br \/>\nif (fe-&gt;type == ZEND_USER_FUNCTION) {<br \/>\n*have_fe = 1;<br \/>\n}<\/p>\n<p>return 0;<br \/>\n}<\/p>\n<p>static int vld_dump_fe (zend_op_array *fe TSRMLS_DC)<br \/>\n{<br \/>\nif (fe-&gt;type == ZEND_USER_FUNCTION) {<br \/>\nfprintf(stderr, &quot;Function %s:<br \/>\n&quot;, fe-&gt;function_name);<br \/>\nvld_dump_oparray(fe);<br \/>\nfprintf(stderr, &quot;End of function %s.<\/p>\n<p>&quot;, fe-&gt;function_name);<br \/>\n}<\/p>\n<p>return ZEND_HASH_APPLY_KEEP;<br \/>\n}<\/p>\n<p>#ifdef ZEND_ENGINE_2<br \/>\nstatic int vld_dump_cle (zend_class_entry **class_entry TSRMLS_DC)<br \/>\n#else<br \/>\nstatic int vld_dump_cle (zend_class_entry *class_entry TSRMLS_DC)<br \/>\n#endif<br \/>\n{<br \/>\nzend_class_entry *ce;<br \/>\nzend_bool have_fe = 0;<\/p>\n<p>#ifdef ZEND_ENGINE_2<br \/>\nce = *class_entry;<br \/>\n#else<br \/>\nce = class_entry;<br \/>\n#endif<\/p>\n<p>if (ce-&gt;type != ZEND_INTERNAL_CLASS) {<br \/>\nzend_hash_apply_with_argument(&amp;ce-&gt;function_table, (apply_func_arg_t) vld_check_fe, (void *)&amp;have_fe TSRMLS_CC);<br \/>\nif (have_fe) {<br \/>\nfprintf(stderr, &quot;Class %s:<br \/>\n&quot;, ce-&gt;name);<br \/>\nzend_hash_apply(&amp;ce-&gt;function_table, (apply_func_t) vld_dump_fe TSRMLS_CC);<br \/>\nfprintf(stderr, &quot;End of class %s.<\/p>\n<p>&quot;, ce-&gt;name);<br \/>\n} else {<br \/>\nfprintf(stderr, &quot;Class %s: [no user functions]<br \/>\n&quot;, ce-&gt;name);<br \/>\n}<br \/>\n}<\/p>\n<p>return ZEND_HASH_APPLY_KEEP;<br \/>\n}<\/p>\n<p>\/* {{{ zend_op_array vld_compile_file (file_handle, type)<br \/>\n* This function provides a hook for compilation *\/<br \/>\nstatic zend_op_array *vld_compile_file(zend_file_handle *file_handle, int type TSRMLS_DC)<br \/>\n{<br \/>\nzend_op_array *op_array;<\/p>\n<p>if (!VLD_G(execute) &amp;&amp;<br \/>\n((VLD_G(skip_prepend) &amp;&amp; PG(auto_prepend_file) &amp;&amp; PG(auto_prepend_file)[0] &amp;&amp; PG(auto_prepend_file) == file_handle-&gt;filename) ||<br \/>\n(VLD_G(skip_append) &amp;&amp; PG(auto_append_file) &amp;&amp; PG(auto_append_file)[0] &amp;&amp; PG(auto_append_file) == file_handle-&gt;filename)))<br \/>\n{<br \/>\nzval nop;<br \/>\nZVAL_STRINGL(&amp;nop, &quot;RETURN ;&quot;, 8, 0);<br \/>\nreturn compile_string(&amp;nop, &quot;NOP&quot; TSRMLS_CC);;<br \/>\n}<\/p>\n<p>op_array = old_compile_file (file_handle, type TSRMLS_CC);<\/p>\n<p>if (op_array) {<br \/>\nvld_dump_oparray (op_array);<br \/>\n}<\/p>\n<p>zend_hash_apply (CG(function_table), (apply_func_t) vld_dump_fe TSRMLS_CC);<br \/>\nzend_hash_apply (CG(class_table), (apply_func_t) vld_dump_cle TSRMLS_CC);<\/p>\n<p>return op_array;<br \/>\n}<br \/>\n\/* }}} *\/<\/p>\n<p>\/* {{{ void vld_execute(zend_op_array *op_array TSRMLS_DC)<br \/>\n* This function provides a hook for execution *\/<br \/>\nstatic void vld_execute(zend_op_array *op_array TSRMLS_DC)<br \/>\n{<br \/>\n\/\/ nothing to do<br \/>\n}<br \/>\n\/* }}} *\/<\/p><\/div>\n<\/div>\n<p><a href=\"uploads\/200510\/25_124437_vld080.tgz\" title=\"uploads\/200510\/25_124437_vld080.tgz\" target=\"_blank\"><img decoding=\"async\" src=\"\/\/icon_file.gif\" border=\"0\" \/> Click Here To Download<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>ps:\u672c\u4eba\u8fd8\u6ca1\u6709\u6d4b\u8bd5\u8fc7\uff0c\u65b9\u6cd5\u4ec5\u4f9b\u53c2\u8003\uff0e\u6b64\u65b9\u6cd5\u53ea\u4f5c\u4e3a\u5b66\u4e60\u4e4b\u7528\uff0c\u8bf7\u52ff\u4f5c\u5176\u4ed6\u7528\u9014\uff0e \u5148\u4e0b\u8f7d\uff1a vld-0.8.0 \u4e0b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[],"tags":[],"class_list":["post-315","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/www.mudone.com\/index.php?rest_route=\/wp\/v2\/posts\/315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mudone.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mudone.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mudone.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mudone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=315"}],"version-history":[{"count":0,"href":"https:\/\/www.mudone.com\/index.php?rest_route=\/wp\/v2\/posts\/315\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.mudone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mudone.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mudone.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}