How to compile PHP into opcode and run it in production environment?
Note,it's not what the recent hiphop project of f开发者_运维百科acebook,I just want to convert it into opcode
,not c/c++
.
Is there a solution yet?
A demo is always the best!
What you're looking for is a PHP Accelerator
However, these tools compile to bytecode, not opcode as requested.
@Dolph's answer is correct: There's no way to compile PHP directly to opcode
. The PHP binary itself compiles PHP code to PHP bytecode
and then executes those bytecodes. The best you can expect it to cache the compiled bytecode with a PHP accelerator. Other than that, the only route would be to use a langugae which does compile to opcode, which is the aim of the Facebook hiphop project.
For some additional information:
- http://en.wikipedia.org/wiki/PHP#Usage
- http://www.php.net/manual/en/intro.bcompiler.php
- http://eaccelerator.net/
- http://www.zend.com/en/products/guard/zend-optimizer
- http://www.php.net/manual/en/book.apc.php
精彩评论