4

I've been searching a way to compile PHP source code and using it in a PHP script by loading the compiled code. No resultat yet, a small try using bcompiler but it's not compiling due to changes on the Zend core API, maybe small parts need to be replaced.

Other try with no success was using phpc, the version recommend for the compiler is PHP 5.2, so the API no longer supports changes to 5.4.

5
  • 3
    Php isn't compiled. It's a scripting language. Are you trying to identify errors or something? Commented Oct 29, 2012 at 23:02
  • @StevenLeimberg PHP certainly can be compiled... github.com/facebook/hiphop-php bambalam.se/bamcompile sourceforge.net/projects/binaryphp roadsend.com/home/index.php?pageID=compiler Commented Oct 29, 2012 at 23:06
  • 1
    There are a number of compilers for PHP, but the only one I know of that's current is HipHop, written by Facebook. But I think that's targetted at PHP 5.3. Commented Oct 29, 2012 at 23:07
  • It seems like many of these convert PHP to C++ or similar & then compile that to an exe. Cool. I will definitely look into those links. You learn something new every day. :) Commented Oct 30, 2012 at 3:19
  • Try php-ng. It's already merged into the master branch and is confirmed to be in PHP 7 (there won't be a PHP 6). Maybe you also like a simple phar ? Commented Feb 19, 2015 at 21:17

3 Answers 3

1

bcompiler works up to PHP 5.3. I'm currently using it and I can't upgrade to PHP 5.4 now because it isn't supported.

Here is the patch to get it working on Ubuntu 12.04 with the Suhosin patch.

Sign up to request clarification or add additional context in comments.

Comments

1

Roadsend Raven might be an alternative to phpc

Comments

1

I believe Facebook Hiphop's function is to compile PHP into C++ so it might be worth checking out... https://github.com/facebook/hiphop-php/

3 Comments

hiphop is good when using simple function/class with no extra dependencies ?
how about handling php code using thirs party library, soap module, xml module, ldap module ect... not sure hiphop handle that kind of needs
I've never used it myself I'm afraid so that's something you'll have to look at. This might get you some more info... github.com/facebook/hiphop-php/wiki/Running-HipHop and here's some other compilers... stackoverflow.com/a/1408499/295924

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.