我有一个需要分发给客户端的命令行 php 应用程序。我只想给他们一个可执行文件,而不是安装 php 的说明;)
什么是好的 Windows php 编译器,包括对 php 5、curl、TLS 和我使用的一些其他库的支持?
我需要控制内存和时间限制的使用,所以我必须能够使用自定义的 php.ini。 (这也应该打包在exe中,而不是单独的文件)
另外,我不希望代码被轻易提取。这不是一个很大的要求,但我宁愿不要在十六进制编辑器中查看源代码。
我在 Google 上获得了一些点击,但如果有人实际使用过,您的反馈将非常宝贵。
编辑
如果我在开始的时候就知道要将它分发给客户端,我会使用 C#。但我没有。现在他们想买它。它必须非常简单。一个包含 php 解释器和我的脚本的可执行文件以及一个在运行 exe 时启动我的脚本的入口点。
如果我也不必重新分发 dll,那就太好了。
edit2
我正在寻找类似于 phc 的东西, 或 roadsend . phc不支持windows,roadsend不支持windows中的php5。
最佳答案
好吧,我明白了。有一个名为 phc-win 的开源程序.它支持 php 5.3.1,将脚本编译为字节码(混淆!)并且使用简单(它甚至有一个图形用户界面)。
它需要一个 php-embed.ini 和您使用的任何 DLL,但它可以正常工作。
谢谢大家的回答!
phc-win 0.3.1 (c) 2009 Andrew Fitzgerald - contact@swiftlytilting.com 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.
关于用于 Windows 的 PHP 编译器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3189100/