Bambalam PHP EXE
Compiler/Embedder
Created by Anders Hammar ©
2006 Bambalam Bug reports / feedback email:
Download Bamcompile 1.1 (win32) zip Download Bamcompile 1.1 Source
zip
Usage: bamcompile
[-options] infile.php [outfile.exe] bamcompile
[-options] project_directory mainfile.php
[outfile.exe]
Options: -w
Hide console window for windowed
applications -c Compress output exe (using UPX
- must be available) -d Do not encode PHP
files
Revision history: Version
1.1 2006-06-09 Added the php_sockets extension to
the static build + minor bugfixes
- What is
it? 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, or with PHP-GTK). It's also good for making
stand-alone PHP Socket servers/clients (the php_sockets extension is
included in the static build).
It's NOT really a compiler in
the sense that it doesn't produce native machine code from PHP
sources, but it works!
- How does it
work? The converter embeds encoded PHP source files as
resources in a generic statically compiled PHP launcher executable.
It also has an option to compress the final exe using the UPX executable compressor.
Simple console applications end up with an executable at a size of
500-600kb.
- Does "compiled" PHP applications run
faster? Theoretically it should. Having libraries linked
statically and encoding files (Turck MMCache encodes PHP sources as
PHP bytecode, I think) should contribute to faster applications. But
I haven't done any decent tests on it.
- What about
PHP applications with more than one source file? No
problem, the converter is able to embed a whole project directory.
- What about accessing the embedded files from
php? You can access the embedded files just as you're
used to. The PHP runtime used has been modified so that when you're
accessing a file it first tries to access it the usual way (by
looking in the path outside the .exe) and if the files aren't found
there it looks for it in the embedded filelist.
- So
the INCLUDE statement works just as it should? Yes, as
long as you include stuff using relative paths.
-
What PHP version is supported? Currently, the converter
uses a PHP runtime based on PHP 4.4.2
- What about
PHP 5 support? I haven't got around to it, but I
probably will! But PHP 4.4.2 works in most cases, and the PHP 4
runtimes produces alot smaller standalone exe files than PHP 5 would
do. But as I said, just wait for it.
- What
libraries are included? The following libraries are
included in this version: Turck
MMCache bcmath calendar com ctype ftp mysql odbc pcre win32std xml zlib winbinder sockets
What
libraries are included is probably going to change based on your
feedback. Email me at
- What about PHP.INI? Can I embed that as
well? Yes, just include the php.ini in your project
directory. That way, you can add extensions to your application. The
dll files for the extra extensions can't be embedded though. Make
sure you set the extension_dir setting to something relative,
extension_dir = "" works fine.
- What about PHP-GTK
applications? PHP-GTK apps should work just fine as long
as you supply all the needed GTK extensions and libraries. Make sure
you have the libraries for the correct PHP version (currently
4.4.2). PHP-GTK isn't statically included (it's way too complex), if
you're developing for the windows platform only then maybe you
should have a look at WinBinder instead.
- What about license? Just how free is this
utility? Well, I guess that the tool is released as open
source under the PHP License. Sources are available on the website.
I don't really know much about licensing :), let's just say that
it's free, and I don't want to get sued. Ok?
This site
copyright © Bambalam
| |