Looking for PHP 5.4 and more to EXE compiler

560 Views Asked by At

I have my own PHP CLI utility, so I have a need in PHP compiler. I found nothing working with the last PHP versions, so I'm using a Phalanger now, but it's requires it installed on client mashine to run compiled scripts (!), and it's compiles files in .NET (!!). It's worth crutch I've ever seen, but it's working and have a console version (because I'm using Notepad++ for development). I don't know why only worth crutch is working) So, that I stays searching for the good console PHP compiler all time, but found nothing at this time. All what I found is extremely old. There's a list and year of last release:

  • phc: 2011
  • Roadsend PHP Compiler: 2010
  • Bambalam: 2006
  • BinaryPHP: 2003 (!)

There's a HipHop released by FB, but it's so monstrous to use it, and it's only looks like a virtual mashine, not compiler in fact I think. So finally I've decided to write my own compiler to work with new versions of PHP and use a native bcompiler to get a bytecode, but find out, that a bcompiler is dead too, its last release was at 2011! So can I ask you, why all PHP comilers are dead? There's no problem to find a bcompiler sourses, build a new DLL extention for PHP for Windows for example, and put the actual PHP DLL version with it, but why in times, when the amazing PHP 7 was released, there's no any (any!) lightweight and simple actual PHP compilers?

Or I don't understand something? If it so - what? Thanks a lot!

3

There are 3 best solutions below

0
Acuna On BEST ANSWER

After a while looking for solution I've wrote my own compiler, which supports PHP 7.1+ (!). So my problem is solved. Thanks to everybody!

Here is it: https://sourceforge.net/projects/phpc/

6
Danial On

It's a big project that never ends, because php is evolving and growing (unlike a language like C). Open source maintainers move on to other things, like spending time with their family, or getting a job.

I think the projects died because they generally didn't work for real life projects. At best you could compile a few scripts, but most would fail at some point with a big project. For web development, which I suspect is 98% of the applications, you have embedded scripts and styles that just aren't compatible with compiling. So you have to write code differently to use a compiler, which in some ways defeats the purpose of using PHP in the first place.

There are so many versions of PHP the compilers were also so far behind to be rendered useless. You really have to come up with another way to protect your product. There's a decoder for every commercial encoder, so there's really no way to protect your code from someone who wants to get it. I use ioncube to encode my scripts but that's just to keep customers from breaking things and then complaining that it doesnt work.

0
dkellner On

For compiling very simple (one-file) tools, there's PHPFlexer: http://www.softpedia.com/get/Programming/Debuggers-Decompilers-Dissasemblers/PHPFlexer.shtml

(It's based on phc-win but easier to use)