{"id":15,"date":"2006-07-25T01:25:30","date_gmt":"2006-07-24T17:25:30","guid":{"rendered":"http:\/\/blog.urdada.net\/2006\/07\/25\/15\/"},"modified":"2010-04-02T17:50:19","modified_gmt":"2010-04-02T09:50:19","slug":"%e4%bd%bf%e7%94%a8-bcompiler-%e4%be%86%e7%b7%a8%e8%ad%af%ef%bc%88%e5%8a%a0%e5%af%86%ef%bc%89%e6%82%a8%e7%9a%84-php-%e5%8e%9f%e5%a7%8b%e7%a2%bc","status":"publish","type":"post","link":"https:\/\/dada.tw\/blog\/2006\/07\/25\/15\/","title":{"rendered":"\u4f7f\u7528 bcompiler \u4f86\u7de8\u8b6f\uff08\u52a0\u5bc6\uff09\u60a8\u7684 PHP \u539f\u59cb\u78bc"},"content":{"rendered":"<p><strong>Using bcomipler to  compile (encode) your PHP script (in FreeBSD)<\/strong><\/p>\n<p><a href=\"http:\/\/eaccelerator.net\/\" target=\"_blank\">eAccelerator<\/a> \u7684 encoder \u5728 PHP  5.1 \u4ee5\u5f8c\u5c31\u7121\u6cd5\u904b\u4f5c\u4e86\uff0c\u4f7f\u662f\u6700\u65b0\u7684\u7248\u672c 0.9.5 \u4e5f\u4e0d\u884c\uff0c\u56e0\u6b64\u5982\u679c\u60a8\u9084\u60f3\u7528 eAccelerator \u7684 encoder\uff0c\u4e56\u4e56\u5f85\u5728  PHP 4.x or PHP 5.0 \u5427\uff0c\u76f8\u95dc\u8cc7\u8a0a\u53ef\u53c3\u8003\u4e4b\u524d\u7684\u5169\u7bc7\u6587\u7ae0\uff1a<\/p>\n<ul>\n<li><a href=\"http:\/\/blog.urdada.net\/2005\/12\/12\/16\/\" target=\"_blank\">eAccelerator \u7121\u6cd5\u4f7f\u7528\u65bc PHP 5.1<\/a><\/li>\n<li><a href=\"http:\/\/www.wretch.cc\/blog\/cdsheen&amp;article_id=3802770\" target=\"_blank\">\u5c07 PHP \u5f9e 5.1 \u964d\u81f3 5.0 (with portdowngrade)<\/a><\/li>\n<\/ul>\n<p>\u6839\u64da mailing  list \u4e0a\u9762\u4f5c\u8005\u6700\u65b0\u7684<a href=\"http:\/\/sourceforge.net\/mailarchive\/message.php?msg_id=24006812\" target=\"_blank\">\u8aaa\u6cd5<\/a>\uff0c\u77ed\u671f\u5167\u61c9\u8a72\u90fd\u9084\u4e0d\u6703\u4fee\u5fa9\uff0c\u751a\u81f3\u6709\u53ef\u80fd\u9084\u6703\u653e\u68c4\u652f\u63f4 encoder \u90e8\u4efd\uff0c\u4f5c\u8005\u9084\u63a8\u85a6\u5927\u5bb6\u6539\u7528 <a href=\"http:\/\/www.php.net\/manual\/en\/ref.bcompiler.php\" target=\"_blank\">bcompiler<\/a> &#8230; orz<br \/>\n\u6240\u4ee5\u5982\u679c\u4f60\u8ddf\u6211\u4e00\u6a23\u5fc5\u9808\u8981\u7528 PHP 5.1 \u7684\u8a71\uff0c\u5c31\u8ddf\u6211\u4e00\u8d77\u4f86\u73a9\u770b\u770b <a href=\"http:\/\/www.php.net\/manual\/en\/ref.bcompiler.php\" target=\"_blank\">bcompiler<\/a> \u56c9<\/p>\n<p>\u9644\u5e36\u4e00\u63d0\uff0c\u539f\u672c\u662f\u8981\u8cb7 <a href=\"http:\/\/www.ioncube.com\/\" target=\"_blank\">ionCube<\/a> \u516c\u53f8\u958b\u767c\u7684 <a href=\"http:\/\/www.ioncube.com\/sa_encoder.php\" target=\"_blank\">PHP Encoder<\/a>  \u7684\uff0c\u9019\u770b\u4f86\u662f\u76ee\u524d\u7de8\u8b6f\uff08\u52a0\u5bc6\uff09PHP \u539f\u59cb\u78bc\u6700\u597d\u7684\u9078\u64c7\uff0c\u50f9\u683c\u4e5f\u4e0d\u7b97\u8cb4\uff0c\u800c\u4e14\u82b1\u7684\u662f\u516c\u53f8\u7684\u9322\uff0c\u4e0d\u904e\u9084\u662f\u5148\u8a66\u7528\u770b\u770b bcompiler  \u597d\u4e86\uff0c\u771f\u7684\u4e0d\u597d\u7528\u7684\u8a71\uff0c\u518d\u4f86\u8cb7\u56c9<\/p>\n<p>\u4ee5\u4e0b\u7684\u5b89\u88dd\u8207\u4f7f\u7528\u8aaa\u660e\u5747\u4ee5 FreeBSD  \u70ba\u7bc4\u4f8b\uff0c\u5176\u4ed6\u4f5c\u696d\u7cfb\u7d71\u61c9\u8a72\u4e5f\u5dee\u4e0d\u591a\uff0c\u8acb\u81ea\u5df1\u8a66\u770b\u770b\u5427<\/p>\n<p>\u5728\u6b63\u5f0f\u5b89\u88dd\u4e4b\u524d\u63d0\u9192\u4f60\uff0c<a href=\"http:\/\/www.php.net\/manual\/en\/ref.bcompiler.php\" target=\"_blank\">bcompiler<\/a> \u6703\u7528\u5230 <a href=\"http:\/\/tw.php.net\/manual\/en\/ref.bzip2.php\" target=\"_blank\">bzip2<\/a> \u9019\u500b  extension\uff0c\u6240\u4ee5\u5148\u5b89\u88dd\u4e00\u4e0b php5-bz2\uff1a<\/p>\n<pre class=\"small\"># cd \/usr\/ports\/archivers\/php5-bz2\r\n# make install clean<\/pre>\n<p><a href=\"http:\/\/www.php.net\/manual\/en\/ref.bcompiler.php\" target=\"_blank\">bcompiler<\/a> \u662f\u4e00\u500b\u6536\u5bb9\u65bc <a href=\"http:\/\/pecl.php.net\/\" target=\"_blank\">PECL<\/a> \u7684 PHP extension\uff0c\u60a8\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528 pecl \u9019\u500b\u547d\u4ee4\u4f86\u5b89\u88dd\uff0c\u800c pecl \u7684\u4f7f\u7528\u65b9\u6cd5\u8207 <a href=\"http:\/\/pear.php.net\/\" target=\"_blank\">pear<\/a> \u76f8\u540c\uff0c\u56e0\u6b64\u4f60\u5fc5\u9808\u5148\u5b89\u88dd <a href=\"http:\/\/pear.php.net\/\" target=\"_blank\">pear<\/a> :<\/p>\n<pre class=\"small\"># cd \/usr\/ports\/devel\/pear\r\n# make install clean<\/pre>\n<p>pear \u5b89\u88dd\u597d\u5f8c\uff0c\u540c\u6642\u6703\u6709\u4e00\u500b pecl \u547d\u4ee4\u53ef\u7528 (\/usr\/locel\/bin\/pecl)\uff0c\u53ef\u7528\u5b83\u4f86\u5b89\u88dd bcompiler<\/p>\n<pre class=\"small\">pecl install channel:\/\/pecl.php.net\/bcompiler-0.8<\/pre>\n<p>\u4e0d\u904e\u5462\uff0c\u6211\u767c\u73fe\u76f4\u63a5\u57f7\u884c pecl \u6703\u767c\u751f\u932f\u8aa4\uff08\u81f3\u5c11\u5728 FreeBSD \u4e0b\u662f\u5982\u6b64\uff09\uff1a<\/p>\n<pre class=\"small\"># pecl\r\nFatal error: Call to undefined function preg_match() in ...<\/pre>\n<p>\u554f\u984c\u51fa\u5728 \/usr\/local\/bin\/pecl \u9019\u500b script \u7684\u6700\u5f8c\u4e00\u884c\uff1a<\/p>\n<pre class=\"small\">exec $PHP -C -n -q $INCARG -d output_buffering=1 -d safe_mode=0 ...<\/pre>\n<p>\u9019\u4e00\u884c\u7684 -n \u9019\u500b\u9078\u9805\u4ee3\u8868\u4e0d\u8f09\u5165 php.ini \u8a2d\u5b9a\u6a94\uff0c\u56e0\u6b64 pcre.so  \u5c31\u6c92\u6709\u88ab\u8f09\u5165\uff0c<br \/>\n\u7136\u5f8c\u4f60\u5c31\u770b\u5230\u4e0a\u9762\u7684\u932f\u8aa4\u4e86\uff0c\u6240\u4ee5\u81ea\u5df1\u53bb\u6539\u4e00\u4e0b\u7a0b\u5f0f\u628a -n \u62ff\u6389\u5427&#8230;.<\/p>\n<p>\u62ff\u6389\u4e4b\u5f8c\uff0c\u5b89\u88dd\u7a0b\u5f0f\u61c9\u8a72\u5c31\u53ef\u4ee5\u6b63\u5e38\u904b\u4f5c\u4e86\u4e86\uff1a<\/p>\n<pre class=\"small\">pecl install channel:\/\/pecl.php.net\/bcompiler-0.8<\/pre>\n<p>\u5b89\u88dd\u597d\u5f8c\uff0c\u8a18\u5f97\u8981\u6539\u8a2d\u5b9a\u628a bcompiler \u9019\u500b extension \u8f09\u5165<\/p>\n<pre class=\"small\"># echo \"extension=bcompiler.so\" &gt;&gt; \/usr\/local\/etc\/php\/extensions.ini<\/pre>\n<p>bcompiler \u5168\u540d\u662f PHP bytecode Compiler\uff0c\u8a73\u7d30\u7684\u4f7f\u7528\u65b9\u6cd5\u53ef\u4ee5\u53c3\u8003 PHP \u7db2\u7ad9\u4e0a\u7684\u8a73\u7d30\u8aaa\u660e\uff1a PHP  bytecode Compiler: <a href=\"http:\/\/www.php.net\/manual\/en\/ref.bcompiler.php\" target=\"_blank\">http:\/\/www.php.net\/manual\/en\/ref.bcompiler.php<\/a><\/p>\n<p>\u770b\u4e0d\u61c2\u7684\u8a71\uff0c<a href=\"http:\/\/www.php.net\/manual\/en\/function.bcompiler-write-file.php\" target=\"_blank\">bcompiler_write_file()<\/a> \u9019\u500b function \u7684\u8aaa\u660e\u88e1\u9762\u6709\u7bc4\u4f8b\uff1a<\/p>\n<pre class=\"small\">$fh = fopen(\"example.phb\", \"w\");\r\nbcompiler_write_header($fh);\r\nbcompiler_write_file($fh, \"example.php\");\r\nbcompiler_write_footer($fh);\r\nfclose($fh);<\/pre>\n<p>\u70ba\u4e86\u6613\u65bc\u4f7f\u7528\uff0c\u6211\u5beb\u4e86\u4e00\u500b\u7c21\u55ae\u7684 <a href=\"http:\/\/bencoder.urdada.net\/\" target=\"_blank\">script<\/a>\uff0c\u4f7f\u7528\u65b9\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre class=\"small\">BENCODER v1.3 - Encode your PHP script using bcompiler\r\n\r\nUsage: bencoder [-f] [-q] -o FILE    file1.php\r\n       bencoder [-f] [-q] -o OUTDIR  file1.php file2.php ...\r\n       bencoder [-f] [-q] -o OUTDIR  -s SRCDIR  [-e SUFFIX] [-r] [-c] [-l]\r\n\r\n  -o FILE   : the file name to write the encoded script\r\n              (default to '-encoded.XXX' suffix)\r\n  -o OUTDIR : the directory to write all encoded files\r\n\r\n  -a SRCDIR\r\n  -s SRCDIR : encode all files in this source directory\r\n\r\n  -r        : encode directories recursively (no by default)\r\n  -f        : force overwriting even if the target exists\r\n  -e SUFFIX : encode the files with the SUFFIX extension only (default: php)\r\n              (regular expression allowed, ex: \"php|inc\")\r\n  -c        : copy files those shouldn't be encoded (no by default)\r\n  -l        : follow symbolic link (no by default)\r\n  -q        : do not print the file name while encoding or copying\r\n  -b\r\n  -bz2      : compress the encoded files with bz2 (needs bzip2-extension)<\/pre>\n<p>\u60f3\u7528\u7684\u4eba\u5230 <a href=\"http:\/\/bencoder.urdada.net\/\" target=\"_blank\">\u9019\u908a<\/a>  \u81ea\u5df1\u6293\u56de\u53bb\u73a9\u73a9\u770b\u5427<\/p>\n<pre class=\"small\"># wget http:\/\/bencoder.urdada.net\/bencoder\r\n# chmod 755 bencoder\r\n# mv bencoder \/usr\/local\/bin\/<\/pre>\n<p>\u5728\u628a\u7a0b\u5f0f\u4f7f\u7528 bcompiler \u7de8\u78bc\u4e4b\u5f8c\uff0c\u57f7\u884c\u7684\u6642\u5019\u767c\u89ba $_SERVER \u4ee5\u53ca $_ENV  \u7684\u8b8a\u6578\u90fd\u4e0d\u898b\u4e86\uff0c\u5f8c\u4f86\u67e5\u4e86\u8cc7\u6599\uff0c\u624d\u767c\u73fe\u8981\u628a <a href=\"http:\/\/www.php.net\/manual\/en\/ini.core.php#ini.auto-globals-jit\" target=\"_blank\">auto_globals_jit<\/a> \u95dc\u6389 (Off) \u624d\u884c\uff0c\u8acb\u76f4\u63a5\u4fee\u6539\u60a8\u7684 php.ini \uff1a<\/p>\n<pre class=\"small\">; When enabled, the SERVER and ENV variables are created when they're first\r\n; used (Just In Time) instead of when the script starts. If these variables\r\n; are not used within a script, having this directive on will result in a\r\n; performance gain. The PHP directives register_globals, register_long_arrays,\r\n; and register_argc_argv must be disabled for this directive to have any affect.\r\nauto_globals_jit = Off<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Using bcomipler to compile (encode) your PHP script (in [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[10],"tags":[],"class_list":["post-15","post","type-post","status-publish","format-standard","hentry","category-language"],"views":15504,"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pubdi-f","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":18,"url":"https:\/\/dada.tw\/blog\/2005\/06\/23\/18\/","url_meta":{"origin":15,"position":0},"title":"eAccelerator &#8211; PHP \u7db2\u9801\u52a0\u901f\u53ca\u7de8\u78bc","author":"dada","date":"2005-06-23","format":false,"excerpt":"eAccelerator - PHP \u7db2\u9801\u52a0\u901f\u53ca\u7de8\u78bc\u8edf\u9ad4 http:\/\/eaccelerator.n\u2026","rel":"","context":"\u5728\u300c\u7a0b\u5f0f\u8a9e\u8a00\u300d\u4e2d","block_context":{"text":"\u7a0b\u5f0f\u8a9e\u8a00","link":"https:\/\/dada.tw\/blog\/category\/comp\/language\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":16,"url":"https:\/\/dada.tw\/blog\/2005\/12\/12\/16\/","url_meta":{"origin":15,"position":1},"title":"eAccelerator \u7121\u6cd5\u4f7f\u7528\u65bc PHP 5.1","author":"dada","date":"2005-12-12","format":false,"excerpt":"\u4e0a\u500b\u6708 PHP 5.1 \u6b63\u5f0f\u767c\u8868\u4e86 \u6628\u5929\u4e00\u6642\u8208\u8d77\uff0c\u628a PHP 5.0 \u5229\u7528 portupgrade \u2026","rel":"","context":"\u5728\u300c\u7a0b\u5f0f\u8a9e\u8a00\u300d\u4e2d","block_context":{"text":"\u7a0b\u5f0f\u8a9e\u8a00","link":"https:\/\/dada.tw\/blog\/category\/comp\/language\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":20,"url":"https:\/\/dada.tw\/blog\/2005\/03\/05\/20\/","url_meta":{"origin":15,"position":2},"title":"\u8b93 FreeBSD \u4e0b\u7684 PHP DBA extension \u80fd\u652f\u63f4 &#8216;dbm&#8217; handler","author":"dada","date":"2005-03-05","format":false,"excerpt":"\u8b93 FreeBSD \u4e0b\u7684 PHP DBA extension \u80fd\u652f\u63f4 'dbm' handler \u5728\u2026","rel":"","context":"\u5728\u300c\u7a0b\u5f0f\u8a9e\u8a00\u300d\u4e2d","block_context":{"text":"\u7a0b\u5f0f\u8a9e\u8a00","link":"https:\/\/dada.tw\/blog\/category\/comp\/language\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":31,"url":"https:\/\/dada.tw\/blog\/2005\/04\/18\/31\/","url_meta":{"origin":15,"position":3},"title":"PHP4 fsockopen() \u7121\u6cd5\u4f7f\u7528 ssl:\/\/ \u7684 bug","author":"dada","date":"2005-04-18","format":false,"excerpt":"PHP 4 \u6709 bug \u6703\u5c0e\u81f4 fsockopen \u7121\u6cd5\u63a5\u53d7 \"ssl:\/\/example.com\"\u2026","rel":"","context":"\u5728\u300c\u7a0b\u5f0f\u8a9e\u8a00\u300d\u4e2d","block_context":{"text":"\u7a0b\u5f0f\u8a9e\u8a00","link":"https:\/\/dada.tw\/blog\/category\/comp\/language\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":82,"url":"https:\/\/dada.tw\/blog\/2008\/03\/02\/82\/","url_meta":{"origin":15,"position":4},"title":"China blocked FeedBurner (problem for FeedSmith)","author":"dada","date":"2008-03-02","format":false,"excerpt":"\u9019\u6b21\u5230\u5927\u9678\u51fa\u5dee\uff0c\u8b93\u6211\u767c\u73fe\u5230\u4e00\u500b\u56b4\u91cd\u7684\u554f\u984c\uff0c\u5c31\u662f Great Firewall (GFW) \u628a\u8457\u540d\u7684 \u2026","rel":"","context":"\u5728\u300c\u7db2\u8def\u79d1\u6280\u300d\u4e2d","block_context":{"text":"\u7db2\u8def\u79d1\u6280","link":"https:\/\/dada.tw\/blog\/category\/network\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":24,"url":"https:\/\/dada.tw\/blog\/2005\/09\/08\/24\/","url_meta":{"origin":15,"position":5},"title":"URL \u542b\u4e2d\u6587\u8def\u5f91\u540d\u7a31\u7684\u7d42\u6975\u89e3\u6cd5","author":"dada","date":"2005-09-08","format":false,"excerpt":"URL \u542b\u4e2d\u6587\u8def\u5f91\u540d\u7a31\u7684\u7d42\u6975\u89e3\u6cd5 - \u5229\u7528 mod_fileiri \u89e3\u6c7a\u4e2d\u6587\u6a94\u540d\u554f\u984c \u7576\u7136\uff0c\u5c0d\u4ed8\u4e2d\u6587\u2026","rel":"","context":"\u5728\u300c\u7db2\u8def\u79d1\u6280\u300d\u4e2d","block_context":{"text":"\u7db2\u8def\u79d1\u6280","link":"https:\/\/dada.tw\/blog\/category\/network\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/dada.tw\/blog\/wp-json\/wp\/v2\/posts\/15","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dada.tw\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dada.tw\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dada.tw\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dada.tw\/blog\/wp-json\/wp\/v2\/comments?post=15"}],"version-history":[{"count":0,"href":"https:\/\/dada.tw\/blog\/wp-json\/wp\/v2\/posts\/15\/revisions"}],"wp:attachment":[{"href":"https:\/\/dada.tw\/blog\/wp-json\/wp\/v2\/media?parent=15"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dada.tw\/blog\/wp-json\/wp\/v2\/categories?post=15"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dada.tw\/blog\/wp-json\/wp\/v2\/tags?post=15"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}