适用于 Windows 的 PHP 编译器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3189100/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
PHP compiler for windows
提问by Byron Whitlock
I have a command line php app that I need to distribute to a client. I just want to give them an executable, not instructions for installing php ;)
我有一个命令行 php 应用程序,我需要将其分发给客户端。我只想给他们一个可执行文件,而不是安装 php 的说明;)
What is a good php compiler for windows that includes support for php 5, curl, TLS, and a few other libs I use?
什么是适用于 Windows 的优秀 php 编译器,包括对 php 5、curl、TLS 和我使用的其他一些库的支持?
I need to control memory and time limit usage, so I must be able to use a custom php.ini. (this should be packaged in the exe as well, not a separate file)
我需要控制内存和时间限制的使用,所以我必须能够使用自定义的 php.ini。(这个也应该打包在exe中,而不是单独的文件)
Additionally, I don't want the code to be easily extracted. This isn't a huge requirement, but I'd rather not have the source viewable in a hex editor.
此外,我不希望轻松提取代码。这不是一个很大的要求,但我宁愿不要在十六进制编辑器中查看源代码。
I've got a few hits on Google, but if anyone has actually used one, your feedback would be invaluable.
我在 Google 上获得了一些成功,但如果有人实际使用过,您的反馈将非常宝贵。
edit
编辑
If I knew I was going to distribute this to the client when i started, I'd have used C#. But I didn't. Now they want to buy it. It needs to be DEAD SIMPLE. one executable containing the php interpreter and my script plus an entry point to start my script when the exe is run.
如果我一开始就知道要分发给客户端,我就会使用 C#。但我没有。现在他们想买。它需要非常简单。一个包含 php 解释器和我的脚本的可执行文件,以及一个在 exe 运行时启动我的脚本的入口点。
It would also be great if I didn't have to redistribute dll's either.
如果我也不必重新分发 dll,那就太好了。
edit2
编辑2
I am look for somthing along the lines of phc, or roadsend. phc doesn't support windows, and roadsend doesn't support php5 in windows.
我正在寻找类似 phc或roadend 的东西。phc不支持windows,roadend不支持windows下的php5。
采纳答案by Byron Whitlock
Okay I figured it out. there is a open source program called phc-win. It supports php 5.3.1, compiles scripts to byte code (obfuscation!) and is simple to use (It even has a gui).
好吧,我想通了。有一个名为phc-win的开源程序。它支持 php 5.3.1,将脚本编译为字节码(混淆!)并且使用简单(它甚至有一个 gui)。
It needs a php-embed.ini and whatever DLL's you use, but it just works.
它需要一个 php-embed.ini 以及您使用的任何 DLL,但它可以正常工作。
Thanks for all the answers everyone!
谢谢大家的回答!
phc-win 0.3.1 (c) 2009 Andrew Fitzgerald - [email protected] PHP Version: 5.3.1
To compile a single file:
- Choose 'Compile single file' from the File menu.
- Then select the file to compile.
To build an EXE containing all files in a directory and all sub directories:
- Choose 'Compile directory' from the File menu.
- Select the project folder.
- Select the main program file.
- phc-win will then recursively scan the specificed directory.
- All files with 'php' anywhere in the extension will be compiled into .phb files.
These .phb files, along with all files in the directory tree will be added to the project EXE.
Once the EXE has been created, you will be asked about the EXE type:
- CONSOLE (displays DOS box)
- WINDOWS (no DOS box).
Place the EXE in the same directory with the required DLL file(s) and php-embed.ini file if needed.
phc-win 0.3.1 (c) 2009 Andrew Fitzgerald - [email protected] PHP 版本:5.3.1
编译单个文件:
- 从“文件”菜单中选择“编译单个文件”。
- 然后选择要编译的文件。
要构建一个包含目录和所有子目录中所有文件的 EXE:
- 从文件菜单中选择“编译目录”。
- 选择项目文件夹。
- 选择主程序文件。
- phc-win 将递归扫描指定的目录。
- 扩展名中任何位置带有“php”的所有文件都将编译为 .phb 文件。
这些 .phb 文件以及目录树中的所有文件都将添加到项目 EXE 中。
创建 EXE 后,系统会询问您 EXE 类型:
- CONSOLE(显示 DOS 框)
- WINDOWS(没有DOS框)。
如果需要,将 EXE 与所需的 DLL 文件和 php-embed.ini 文件放在同一目录中。
回答by Paulo Coghi - Reinstate Monica
You want this: Bamcompile
你想要这个:Bamcompile
http://www.bambalam.se/bamcompile/
http://www.bambalam.se/bamcompile/
You can use the WApache, too:
您也可以使用 WApache:
http://wapache.sourceforge.net/
http://wapache.sourceforge.net/
And, if none of these options satisfy you:
而且,如果这些选项都不满足您:
回答by KristofAkhurst
If you want to run php scripts as Windows executable, the best is Wapache http://sourceforge.net/projects/wapache/and if you want to protect your code try ZZEE
如果您想将 php 脚本作为 Windows 可执行文件运行,最好是 Wapache http://sourceforge.net/projects/wapache/,如果您想保护您的代码,请尝试ZZEE

