How To: PHP Script To Windows EXE File GenerationBy Angsuman Chakraborty, Gaea News Network
Saturday, March 22, 2008
PHP files are scripts which are interpreted by php interpreter (php.exe in windows). Converting them to exe files makes it easy to distribute PHP applications to Windows users. Unfortunately Zend, the PHP company, doesn’t provide a way to convert PHP scripts to Windows executables. Today I am going to show you a simple way to convert your PHP scripts to regular Windows executable files (.exe). Not only that you can also convert an entire directory of PHP scripts and assign one of the files as the main file to execute first. Additionally the source files are encoded which not only improves the performance but also protects your source code. You can also set the icon for the file which is useful when you are distributing your PHP application as a stand-alone executable.
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 with no need for php dlls etc. The php code is encoded using the Turck MMCache Encode library. It’s a perfect solution if you want to distribute your application to Windows users while protecting your source code at the same time. 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! Currently, the converter uses a PHP runtime based on PHP 4.4.4.
The tool is free and open source.
bamcompile [-options] infile.php [outfile.exe]
bamcompile [-options] project_directory mainfile.php [outfile.exe]
-w Hide console window for windowed applications
-c Compress output exe (using UPX)
-d Do not encode PHP files
-e:extension.dll Embed and use PHP extension
-i:icon.ico Add icon to exe
You can download it here.