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 (which can run on a computer without a PHP interpreter installed), CLI bytecode (which require the .NET or Mono framework to be installed), or Java bytecode (which require a Java virtual machine to be installed).

I have also listed some that bundle your PHP program together with a PHP interpreter and transparently (to the end-user) run your script with the interpreter on the target system. These aren't actually compilers, but are listed here since it may interest people who are looking for a way to deploy PHP scripts on other computers.

Incidentally, if obfuscating your code is your purpose, it's also possible to use a PHP encoder or obfuscator.

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. It's free too.

Related Pages

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

PeachPie (Windows, macOS, Linux .NET) New

PeachPie compiles your PHP code into .NET assemblies comprising CIL (short for "Common Intermediate Language", the intermediate code used in .NET programs) byte-code and meta data. The resulting binary can be run on any platform that runs .NET programs (Windows, macOS, Linux). At the time this is written, it can compile PHP 7.1 code. It is open source. PeachPie is a member of the .NET Foundation.

RapidEXE (Windows bundle)

RapidEXE takes your console (ie, command line) PHP programs and produces a Windows executable. It is not a native code compiler, but it does its work by bundling the PHP interpreter together with your script in a single EXE file. When run, the binary automatically extracts the interpreter and supporting files, then executes the script. It also supports making an EXE file from a Python script.

Phalanger (Windows, macOS, Linux .NET)

Phalanger compiles your PHP 5.4 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.

Roadsend PHP (Windows and Linux 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.

Bambalam (Windows bundle)

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.

Project Zero (Java)

(Update: it looks like this software is now defunct.) Project Zero includes a compiler and runtime that can compile your PHP code into Java bytecode and execute it. With it, you can 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

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 Free Webmaster Tutorials, Scripts and Articles Free How-To Guides Free Programmers, Webmasters and Security Resources
If you find this site useful, please link to us.