Free PHP Compilers

Compile PHP scripts to native code, .NET or Java bytecode


Free PHP Compilers: compile PHP scripts to native code, .NET or Java bytecode

The free PHP compilers listed on this page can either compile your PHP scripts to native machine code that can run on a computer without a PHP interpreter installed, or compile them into CLI bytecode (which require the .NET or Mono framework to be installed) or Java bytecode (which require a Java virtual machine to be installed).

Such compilers are useful for a variety of purposes: they can speed up the execution of your script since they are no longer interpreted at runtime, or they can be used so that you can distribute your application without revealing the source code (such as might be done for certain commercial scripts). I suppose there are also situations where someone might want to write an internet-aware program in PHP and distribute it for running on a desktop (as opposed to the usual web apps that run on a server), since PHP is such an easy programming language to learn and comes with lots of built-in functions to access internet facilities. (In such a case, you'll either have to distribute your application with a built-in web server, or use a compiler that compiles a server into your application.)

Incidentally, if obfuscating your code is your purpose, it's also possible to use a PHP accelerator. Such accelerators are also supposed to be able to speed up the execution of your PHP script.

For the record, for the benefit of those who don't know, the official PHP interpreter can be found at the PHP: Hypertext Processor site.

Related Pages

Free PHP Compilers: compile PHP scripts to native code, .NET or Java bytecode

Bambalam New

This program produces standalone Windows .EXE applications from your PHP source code. It is not actually a native code compiler, since it more or less merely encodes your PHP source and embeds a PHP interpreter, but it's listed on this page because it's probably relevant for people who are looking for native and byte-code compilers. At the time this entry was written, the embedded runtime uses PHP 4.4.4. (The program has not been updated since 2006.) The source code for Bambalam is available.

Phalanger (.NET)

Phalanger compiles your PHP code into CLI bytecode (.exe or .dll) that can be run under the .NET 4.0 or Mono frameworks. Your PHP code can use any .NET object and library in addition to the standard PHP extensions. The resulting .NET assemblies can be signed and obfuscated. It also provides project templates to allow you to develop PHP applications from within Visual Studio. It is released under the Apache licence.

HipHop for PHP (native code)

HipHop translates your PHP code into C++ code, which is then compiled using the GNU C++ compiler (see the Free C++ Compilers page) into an executable binary. At the time I write this annotation, the compiler supports most of the features of PHP 5.3 (except things like eval(), of course). It runs and compiles code for 64 bit versions of Linux and FreeBSD. Since the program is distributed in source code form, you'll have to compile it yourself. It is released under the PHP Licence.

Roadsend PHP (native code)

The Roadsend PHP compiler produces native binaries (executables) for Windows and Linux of your PHP scripts. Your scripts are not restricted to being console (command line) programs: they can be built with an embedded web server, allowing them to work the way they do on a website, albeit on your end-user's system. The compiler is released under the GNU GPL and the runtime under the GNU LGPL. Unfortunately, the program is no longer being actively developed.

Project Zero (Java)

Project Zero includes a compiler and runtime that can compile your PHP code into Java bytecode and execute it. Note that Project Zero is actually more than just a PHP compiler/runtime; it's a development environment that lets you develop web applications using either PHP or Groovy (another scripting language). It is available for Windows, Mac OS X and Linux. You will need to have the Java Development Kit installed.

Related Pages

Can't Find What You're Looking For?

Search the site using Google.

Newest Pages

Popular Pages

How to Link to This Page

It will appear on your page as:

Free PHP Compilers: native code, .NET and Java bytecode compilers

 

Logo for thefreecountry.com

 


 

thesitewizard.com: Free Webmaster Tutorials, Scripts and Articles

HowtoHaven.com: Free How-To Guides

thefreecountry.com: Free Programmers, Webmasters and Security Resources
If you find this site useful, please link to us.