Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 12111

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>BCompiler PHP 字节码编译器</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="函数参考"
HREF="funcref.html"><LINK
REL="PREVIOUS"
TITLE="bcsub"
HREF="function.bcsub.html"><LINK
REL="NEXT"
TITLE="bcompiler_load_exe"
HREF="function.bcompiler-load-exe.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="reference"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP 手册</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.bcsub.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.bcompiler-load-exe.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="reference"
><A
NAME="ref.bcompiler"
></A
><DIV
CLASS="TITLEPAGE"
><H1
CLASS="title"
>VIII. BCompiler PHP 字节码编译器</H1
><DIV
CLASS="PARTINTRO"
><A
NAME="AEN14537"
></A
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="bcompiler.intro"
>简介</A
></H1
><DIV
CLASS="warning"
><P
></P
><TABLE
CLASS="warning"
BORDER="1"
WIDTH="100%"
><TR
><TD
ALIGN="CENTER"
><B
>警告</B
></TD
></TR
><TR
><TD
ALIGN="LEFT"
><P
>本扩展模块是<SPAN
CLASS="emphasis"
><I
CLASS="emphasis"
>实验性</I
></SPAN
>的。本模块的行为,包括其函数的名称以及其它任何关于此模块的文档可能会在没有通知的情况下随
PHP 以后的发布而改变。使用本扩展模块风险自担。</P
></TD
></TR
></TABLE
></DIV
><P
>&#13;     Bcompiler was written for several reasons:
     <P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
>To encode entire script in a proprietary PHP application</TD
></TR
><TR
><TD
>To encode some classes and/or functions in a proprietary PHP application</TD
></TR
><TR
><TD
>&#13;       To enable the production of php-gtk applications that could be used on
       client desktops, without the need for a php.exe.
      </TD
></TR
><TR
><TD
>To do the feasibility study for a PHP to C converter</TD
></TR
></TBODY
></TABLE
><P
></P
>
     The first of these goals is achieved using the
     <A
HREF="function.bcompiler-write-header.html"
><B
CLASS="function"
>bcompiler_write_header()</B
></A
>,
     <A
HREF="function.bcompiler-write-file.html"
><B
CLASS="function"
>bcompiler_write_file()</B
></A
> and
     <A
HREF="function.bcompiler-write-footer.html"
><B
CLASS="function"
>bcompiler_write_footer()</B
></A
>
     functions. The bytecode files can
     be written as either uncompressed or plain. 
     To use the generated bytecode, you can simply include it 
     with include or require statements.
    </P
><P
>&#13;     The second of these goals is achieved using the
     <A
HREF="function.bcompiler-write-header.html"
><B
CLASS="function"
>bcompiler_write_header()</B
></A
>,
     <A
HREF="function.bcompiler-write-class.html"
><B
CLASS="function"
>bcompiler_write_class()</B
></A
>,
     <A
HREF="function.bcompiler-write-footer.html"
><B
CLASS="function"
>bcompiler_write_footer()</B
></A
>,
     <A
HREF="function.bcompiler-read.html"
><B
CLASS="function"
>bcompiler_read()</B
></A
>,
     and <A
HREF="function.bcompiler-load.html"
><B
CLASS="function"
>bcompiler_load()</B
></A
> functions. The bytecode files can
     be written as either uncompressed or plain. The
     <A
HREF="function.bcompiler-load.html"
><B
CLASS="function"
>bcompiler_load()</B
></A
> reads a bzip compressed bytecode file,
     which tends to be 1/3 of the size of the original file.
    </P
><P
>&#13;     To create EXE type files, bcompiler has to be used with a modified sapi
     file or a version of PHP which has been compiled as a shared library. In
     this scenario, bcompiler reads the compressed bytecode from the end of the
     exe file.
    </P
><P
>&#13;     bcompiler can improve performance by about 30% when used with uncompressed
     bytecodes only. But keep in mind that uncompressed bytecode can be up
     to 5 times larger than the original source code. Using bytecode
     compression can save your space, but decompression requires much more
     time than parsing a source. bcompiler also does not do any bytecode
     optimization, this could be added in the future...
    </P
><P
>&#13;     In terms of code protection, it is safe to say that it would be impossible
     to recreate the exact source code that it was built from, and without the
     accompanying source code comments. It would effectively be useless to use
     the bcompiler bytecodes to recreate and modify a class. However it is
     possible to retrieve data from a bcompiled bytecode file - so don't put
     your private passwords or anything in it.
    </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="bcompiler.installation"
>安装</A
></H1
><P
>&#13;  short installation note:
  <P
></P
><UL
><LI
><P
>You need at least PHP 4.3.0 for the compression to work</P
></LI
><LI
><P
>&#13;     To install on PHP 4.3.0 and later at the Unix command prompt type
     <B
CLASS="command"
>pear install bcompiler</B
>
    </P
></LI
><LI
><P
>&#13;     To install on Windows, until the binary package distribution
     mechanism is finished please search the archives of the pear-general
     mailing list for pre-built packages. (or send an email to it if you could
     not find a reference)
    </P
></LI
><LI
><P
>&#13;     To install on older versions you need to make some slight changes to the
     build.
    </P
></LI
><LI
><P
>&#13;     untar the <TT
CLASS="filename"
>bcompiler.tgz</TT
> archive into
     <TT
CLASS="filename"
>php4/ext</TT
>.(Get it directly from
     PECL <A
HREF="http://pecl.php.net/get/bcompiler"
TARGET="_top"
>http://pecl.php.net/get/bcompiler</A
>)
    </P
></LI
><LI
><P
>&#13;     If the new directory is now called something like bcompiler-0.x, then you
     should rename it to bcompiler (except you only want to build it as
     self-contained php-module).
    </P
></LI
><LI
><P
>&#13;     If you are using versions before PHP 4.3.0, the you will need to copy the
     <TT
CLASS="filename"
>Makefile.in.old</TT
> to <TT
CLASS="filename"
>Makefile.in</TT
>
     and <TT
CLASS="filename"
>config.m4.old</TT
> to <TT
CLASS="filename"
>config.m4</TT
>.
    </P
></LI
><LI
><P
>&#13;     run <B
CLASS="command"
>phpize</B
> in <TT
CLASS="filename"
>&#13;     ext/bcompiler</TT
>
    </P
></LI
><LI
><P
>&#13;     run <B
CLASS="command"
>./buildconf</B
> in <TT
CLASS="filename"
>php4
     </TT
>
    </P
></LI
><LI
><P
>&#13;     run <B
CLASS="command"
>configure</B
> with <CODE
CLASS="option"
>&#13;     --enable-bcompiler</CODE
> (and your other options)
    </P
></LI
><LI
><P
>&#13;     <B
CLASS="command"
>make; make install</B
>
    </P
></LI
><LI
><P
>that's it.</P
></LI
></UL
>
 </P
></DIV
><DIV
CLASS="section"
><H1
CLASS="section"
><A
NAME="bcompiler.contact"
>Contact Information</A
></H1
><P
>&#13;     If you have comments, bugfixes, enhancements or want to help
     developing this beast, you can drop me a mail at  <A
HREF="mailto:alan_k@php.net"
TARGET="_top"
>alan_k@php.net</A
>. Any help is very
     welcome.
    </P
></DIV
></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>目录</B
></DT
><DT
><A
HREF="function.bcompiler-load-exe.html"
>bcompiler_load_exe</A
>&nbsp;--&nbsp;Reads and creates classes from a bcompiler exe file</DT
><DT
><A
HREF="function.bcompiler-load.html"
>bcompiler_load</A
>&nbsp;--&nbsp;Reads and creates classes from a bz compressed file</DT
><DT
><A
HREF="function.bcompiler-parse-class.html"
>bcompiler_parse_class</A
>&nbsp;--&nbsp;Reads the bytecodes of a class and calls back to a user function</DT
><DT
><A
HREF="function.bcompiler-read.html"
>bcompiler_read</A
>&nbsp;--&nbsp;Reads and creates classes from a filehandle</DT
><DT
><A
HREF="function.bcompiler-write-class.html"
>bcompiler_write_class</A
>&nbsp;--&nbsp;Writes an defined class as bytecodes</DT
><DT
><A
HREF="function.bcompiler-write-constant.html"
>bcompiler_write_constant</A
>&nbsp;--&nbsp;Writes a defined constant as bytecodes</DT
><DT
><A
HREF="function.bcompiler-write-exe-footer.html"
>bcompiler_write_exe_footer</A
>&nbsp;--&nbsp;Writes the start pos, and sig to the end of a exe type file</DT
><DT
><A
HREF="function.bcompiler-write-file.html"
>bcompiler_write_file</A
>&nbsp;--&nbsp;Writes a php source file as bytecodes</DT
><DT
><A
HREF="function.bcompiler-write-footer.html"
>bcompiler_write_footer</A
>&nbsp;--&nbsp;Writes the single character \x00 to indicate End of compiled data</DT
><DT
><A
HREF="function.bcompiler-write-function.html"
>bcompiler_write_function</A
>&nbsp;--&nbsp;Writes an defined function as bytecodes</DT
><DT
><A
HREF="function.bcompiler-write-functions-from-file.html"
>bcompiler_write_functions_from_file</A
>&nbsp;--&nbsp;Writes all functions defined in a file as bytecodes</DT
><DT
><A
HREF="function.bcompiler-write-header.html"
>bcompiler_write_header</A
>&nbsp;--&nbsp;Writes the bcompiler header</DT
><DT
><A
HREF="function.bcompiler-write-included-filename.html"
>bcompiler_write_included_filename</A
>&nbsp;--&nbsp;Writes an included file as bytecodes</DT
></DL
></DIV
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.bcsub.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>起始页</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.bcompiler-load-exe.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>bcsub</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="funcref.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>bcompiler_load_exe</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>