警告 |
此模块是 试验性质的(的模块)。 这意味着基于这些函数上的所有操作,这些函数名,包括所有发布在这里的文档都有可能在不做任何提示的情况下在将来正式发布时发生变动。如果要使用这个模块,请自负风险。 |
编写字节码编译器的缘起是:
在一个 PHP 应用中编译类 |
使一个 php-gtk 应用程序在没有 php.exe 的情况下直接在客户端桌面可用。 |
做一个从 PHP 到 C 转换器的可行性学习 |
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.
bcompiler is unlikely to improve performance very much, as it only bypasses the compiler stage of the php running process and replaces it with the import process in bcompiler. It also does not do any bytecode optimization, this could be added in the future...
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..
简略安装指南:
你的 PHP 版本不能低于4.3
当你的 PHP 版本为4.3或更高时,在 Unix 命令提示符下安装请输入 pear install bcompiler
在 Windows 下安装时当你将下载的 PHP 报解压缩完毕后查看 pear-general 邮件列表介绍的所有预置的包(有没有你所要的)。(如果你没有找到可以发送邮件给我们)
要安装在老的版本上你需要(对 PHP 包)做些小的变动
解压缩 bcompiler.tgz 到 php4/ext (请直接从 PEAR http://pear.php.net/get/bcompiler 获取此压缩包)
如果解压后的新目录看起来是 bcompiler-0.x 这样的,那么你需要将之重命名为 bcompiler (除非你想将它编译为一个 PHP 模块)
如果你的 PHP 版本早于4.3,你需要复制 Makefile.in.old 到 Makefile.in , config.m4.old 到 config.m4
运行 ext/bcompiler 里的 phpize
运行 php4里的 ./buildconf
运行 configure with --enable-bcompiler (和你要加入的其它选项)
make; make install
这样就可以了!