将PHP脚本转换为独立的Windows可执行文件 [英] Convert a PHP script into a stand-alone windows executable
问题描述
我想自动化一个相当简单的任务。为此,我写了一个小的PHP脚本,我从命令行使用PHP-CLI运行。现在我想将此脚本移交给某人,但我不想:
- 放弃源代码
- 要求他在系统上安装PHP
有没有办法创建PHP脚本的.exe版本。我真的不太担心解编;我更担心要求用户安装和配置PHP。
Phalanger
http://wiki.php-compiler.net/Phalanger_Wiki p>
http://phalanger.codeplex.com/
Phalanger是一个项目,从布拉格的查尔斯大学开始,并得到微软的支持。它将以PHP脚本语言编写的源代码编译成CIL(公共中间语言)字节码。它处理由.NET Framework的JIT编译器组件完成的编译过程的开始。它不处理本地代码生成或优化。其目的是将PHP脚本编译成.NET程序集,包含CIL代码和元数据的逻辑单元。
Bambalam
http://www.bambalam.se/bamcompile/
Bambalam PHP EXE编译器/ Embedder是一个免费的命令行工具,可将PHP应用程序转换为独立的Windows .exe应用程序。生成的exe文件是完全独立的,不需要php dll等。php代码使用Turck MMCache Encode库进行编码,因此如果您想在保护源代码的同时分发应用程序,这是一个完美的解决方案。转换器也适用于生成窗口化PHP应用程序(使用例如WinBinder库创建)的.exe文件。它也适用于制作独立的PHP Socket服务器/客户端(使用php_sockets.dll扩展)。
这不是一个真正的编译器,它不是从PHP源生成本机机器代码,但它的工作原理!
ZZEE PHPExe
ZZEE PHPExe编译PHP,HTML,Javascript,Flash和其他web文件转换为Windows GUI exes。您可以通过使用熟悉的PHP Web范例来快速开发Windows GUI应用程序。您可以对在线和Windows应用程序使用相同的代码,而无需修改。
http://wiki.swiftlytilting.com/Phc-win\">http://wiki.swiftlytilting.com/Phc-win
PHP扩展bcompiler用于将PHP脚本代码编译成PHP字节码。这个字节码可以像任何PHP文件一样,只要加载bcompiler扩展。一旦所有的字节码文件被创建,一个修改的嵌入程序用于将所有的项目文件打包到程序exe中。
需要
- php5ts.dll
- php_win32std.dll
- php_bcompiler.dll
- php-embed.ini
ExeOutput
商业
WinBinder
WinBinder是PHP的开源扩展,是脚本编程语言。它允许PHP程序员轻松构建本机Windows应用程序,以最小的努力生成快速和有价值的结果。由于PHP的强大功能和灵活性,即使是几十行的简短脚本也能生成有用的程序。
PHPDesktop
http://code.google.com/p/phpdesktop/
PHP桌面是由Czarek Tomczak于2012年创建的一个开源项目,为使用诸如PHP,HTML5,JavaScript& SQLite。这个项目不仅仅是一个PHP到EXE编译器,它嵌入了一个web浏览器(Internet Explorer或Chrome嵌入式),一个Mongoose的网络服务器和一个PHP解释器。您使用的开发工作流程保持不变,将现有网站转换为桌面应用程序的步骤基本上是将其复制到www /目录的问题。使用SQLite数据库是可选的,您可以在应用程序的安装程序中嵌入mysql / postgresql数据库。
PHP Nightrain
http://www.naetech.com/php-nightrain
使用PHP Nightrain,您将能够在Windows,Mac和Linux操作系统上部署和运行HTML,CSS,JavaScript和PHP Web应用程序作为本地桌面应用程序。
phc-winfork
http://github.com/RDashINC/phc-win p>
一个或多或少的分支版本的phc-win,它使用与phc-win相同的技术,但支持几乎所有的现代PHP版本。 (5.3,5.4,5.5,5.6,etc)它也可以使用Enigma VB来组合php5ts.dll与您的EXE,以及UPX压缩它。最后,它有win32std和winbinder静态编译成PHP。
EDIT
另一个选项是使用
http ://www.appcelerator.com/products/titanium-cross-platform-application-development/
一个在线编译器,可以构建一个数字的可执行文件不同平台的语言,包括PHP
TideSDK
TideSDK实际上是更名为Titanium Desktop项目。 Titanium仍然专注于移动设备,并放弃了桌面版本,它被一些开源的用户接管并被称为TideSDK。
一般来说,TideSDK使用HTML, CSS和JS渲染应用程序,但它支持脚本语言(如PHP)作为插件模块,以及其他脚本语言(如Python和Ruby)。
I want to automate a fairly simple task. For this I have written a small PHP script which I run from the command line using PHP-CLI. Now I want to hand over this script to someone but I do not want to:
- give away the source code
- ask him to install PHP on the system
Is there a way to create a .exe version of the PHP script. I am really not much worried about de-compilation; I am more worried about asking people to install and configure PHP.
Phalanger
http://wiki.php-compiler.net/Phalanger_Wiki
http://phalanger.codeplex.com/
Phalanger is a project which was started at Charles University in Prague and was supported by Microsoft. It compiles source code written in the PHP scripting language into CIL (Common Intermediate Language) byte-code. It handles the beginning of a compiling process which is completed by the JIT compiler component of the .NET Framework. It does not address native code generation nor optimization. Its purpose is to compile PHP scripts into .NET assemblies, logical units containing CIL code and meta-data.
Bambalam
http://www.bambalam.se/bamcompile/
Bambalam PHP EXE Compiler/Embedder is a free command line tool to convert PHP applications to standalone Windows .exe applications. The exe files produced are totally standalone, no need for php dlls etc. The php code is encoded using the Turck MMCache Encode library so it's a perfect solution if you want to distribute your application while protecting your source code. The converter is also suitable for producing .exe files for windowed PHP applications (created using for example the WinBinder library). It's also good for making stand-alone PHP Socket servers/clients (using the php_sockets.dll extension). It's NOT really a compiler in the sense that it doesn't produce native machine code from PHP sources, but it works!
ZZEE PHPExe
ZZEE PHPExe compiles PHP, HTML, Javascript, Flash and other web files into Windows GUI exes. You can rapidly develop Windows GUI applications by employing the familiar PHP web paradigm. You can use the same code for online and Windows applications with little or no modification. It is a Commercial product.
phc-win
http://wiki.swiftlytilting.com/Phc-win
The PHP extension bcompiler is used to compile PHP script code into PHP bytecode. This bytecode can be included just like any php file as long as the bcompiler extension is loaded. Once all the bytecode files have been created, a modified Embeder is used to pack all of the project files into the program exe.
Requires
- php5ts.dll
- php_win32std.dll
- php_bcompiler.dll
- php-embed.ini
ExeOutput
Commercial
WinBinder
WinBinder is an open source extension to PHP, the script programming language. It allows PHP programmers to easily build native Windows applications, producing quick and rewarding results with minimum effort. Even short scripts with a few dozen lines can generate a useful program, thanks to the power and flexibility of PHP.
PHPDesktop
http://code.google.com/p/phpdesktop/
PHP Desktop is an open source project founded by Czarek Tomczak in 2012 to provide a way for developing native desktop applications using web technologies such as PHP, HTML5, JavaScript & SQLite. This project is more than just a PHP to EXE compiler, it embeds a web-browser (Internet Explorer or Chrome embedded), a Mongoose web-server and a PHP interpreter. The development workflow you are used to remains the same, the step of turning an existing website into a desktop application is basically a matter of copying it to "www/" directory. Using SQLite database is optional, you could embed mysql/postgresql database in application's installer.
PHP Nightrain
http://www.naetech.com/php-nightrain
Using PHP Nightrain you will be able to deploy and run HTML, CSS, JavaScript and PHP web applications as a native desktop application on Windows, Mac and the Linux operating systems. Popular PHP Frameworks (e.g. CakePHP, Laravel, Drupal, etc…) are well supported!
phc-win "fork"
http://github.com/RDashINC/phc-win
A more-or-less forked version of phc-win, it uses the same techniques as phc-win but supports almost all modern PHP versions. (5.3, 5.4, 5.5, 5.6, etc) It also can use Enigma VB to combine the php5ts.dll with your exe, aswell as UPX compress it. Lastly, it has win32std and winbinder compilied statically into PHP.
EDIT
Another option is to use
http://www.appcelerator.com/products/titanium-cross-platform-application-development/
an online compiler that can build executables for a number of different platforms, from a number of different languages including PHP
TideSDK
TideSDK is actually the renamed Titanium Desktop project. Titanium remained focused on mobile, and abandoned the desktop version, which was taken over by some people who have open sourced it and dubbed it TideSDK.
Generally, TideSDK uses HTML, CSS and JS to render applications, but it supports scripted languages like PHP, as a plug-in module, as well as other scripting languages like Python and Ruby.
这篇关于将PHP脚本转换为独立的Windows可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!