<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.4 $ --> <!-- Purpose: basic.php --> <!-- Membership: pecl --> <reference id="ref.bcompiler"> <title>PHP bytecode Compiler</title> <titleabbrev>bcompiler</titleabbrev> <partintro> <section id="bcompiler.intro"> &reftitle.intro; &warn.experimental; <para> Bcompiler was written for several reasons: <simplelist> <member>To encode entire script in a proprietary PHP application</member> <member>To encode some classes and/or functions in a proprietary PHP application</member> <member> To enable the production of php-gtk applications that could be used on client desktops, without the need for a php.exe. </member> <member>To do the feasibility study for a PHP to C converter</member> </simplelist> The first of these goals is achieved using the <function>bcompiler_write_header</function>, <function>bcompiler_write_file</function> and <function>bcompiler_write_footer</function> 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. </para> <para> The second of these goals is achieved using the <function>bcompiler_write_header</function>, <function>bcompiler_write_class</function>, <function>bcompiler_write_footer</function>, <function>bcompiler_read</function>, and <function>bcompiler_load</function> functions. The bytecode files can be written as either uncompressed or plain. The <function>bcompiler_load</function> reads a bzip compressed bytecode file, which tends to be 1/3 of the size of the original file. </para> <para> 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. </para> <para> 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... </para> <para> 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. </para> </section> &reference.bcompiler.configure; <section id="bcompiler.contact"> <title>Contact Information</title> <para> If you have comments, bugfixes, enhancements or want to help developing this beast, you can drop me a mail at <ulink url="mailto:alan_k@php.net">alan_k@php.net</ulink>. Any help is very welcome. </para> </section> </partintro> &reference.bcompiler.functions; </reference> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t sgml-parent-document:nil sgml-default-dtd-file:"../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->