How to compile PHP into opcode and run it in production environment?

孤街醉人 提交于 2019-12-07 07:55:10

问题


Note,it's not what the recent hiphop project of facebook,I just want to convert it into opcode,not c/c++.

Is there a solution yet?

A demo is always the best!


回答1:


What you're looking for is a PHP Accelerator

However, these tools compile to bytecode, not opcode as requested.




回答2:


@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:

  1. http://en.wikipedia.org/wiki/PHP#Usage
  2. http://www.php.net/manual/en/intro.bcompiler.php
  3. http://eaccelerator.net/
  4. http://www.zend.com/en/products/guard/zend-optimizer
  5. http://www.php.net/manual/en/book.apc.php


来源:https://stackoverflow.com/questions/2417831/how-to-compile-php-into-opcode-and-run-it-in-production-environment

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!