Can I use Facebook's hiphop with frameworks like Zend Framework, cakephp, symfony

折月煮酒 提交于 2019-12-18 03:33:17

问题


Yesterday Facebook launched HipHop, a sourcecode-converter from php to c++. The set of php functions and constructions is more limited than in standard php.

Are the current popular php frameworks (ZF, CakePHP, symfony) compatible with HipHop? If not, which parts of these frameworks are not usable?


回答1:


If I'm not mistaken, HipHop has not been released yet -- even the wiki page linked from the Facebook annoucement yesterday is not up yet.

So, it's going to be a bit hard to answer, right now.


I suppose it'll all depend on :

  • The features used by the Frameworks -- like already said here and there, stuff like eval is not supported by HipHop
  • The PHP extensions used by the Frameworks : only a couple of those have been ported by Facebook to HipHop.
  • Depending on the Frameworks and your specific needs, maybe/probably some subsets of the Frameworks you are using will be supported, even if not every available components... I suppose time will tell which ;-)



回答2:


With at least ZF and Symfony being used for Enterprise level applications, chances are pretty good they will run with HipHop. If not now, then sooner or later. However, the question is not so much if they can run with these frameworks, but how your supporting IT architecture looks like.

HipHop is for scaling large multiserver high traffic sites like Facebook. In your regular web application, you will likely get no advantage out of it. Just continue to use memcache and APC.

See these related articles:

  • http://www.readwriteweb.com/archives/rasmus-lerdorf-php-hiphop-facebook.php
  • http://ilia.ws/archives/213-My-Thoughts-on-HipHop.html
  • http://terrychay.com/article/hiphop-for-faster-php.shtml
  • http://www.brandonsavage.net/hiphop-for-php-who-benefits-who-doesnt/



回答3:


While I'm sure most of us are curious about what HipHop is going to be, I know it will not be a replacement for PHP - it's very much a niche product: unless you're running a large server farm then the performance benefits vs the maintenance costs just wouldn't justify it.

Perhaps it might be an interesting alternative to use encoded PHP for some people - but again this introduces even greater maintenance overheads. The only low-volume scenario where a compiled PHP would seem to make a lot of sense is for embedded devices (where the software exists to support the hardware and not vice versa) and for very high security installations (where its not a good idea to have a interpreter available).

It's far to early to be able to say what PHP software will work with it. However even once thats established, I'd want to see a solid commitment from any supplier that they were going to explicitly support HipHop in the future before I switched.

C.




回答4:


I won't repeat what has already been said, I'll just add that as soon as HipHop is released you can count on the opensource community to submit patches for your favorite framework for increased compatibility with HipHop.

Also, one good way to test whether your favorite framework is compatible or not would be to launch the test suite using HPHPi (you then know where to concentrate your patching effort ;).




回答5:


Searching for 'eval' gives a lot of false positives, as you get hits for the word "evaluate" in comments, or escapeValue if the search isn't case sensitive, etc.

If you search for 'eval(' in ZF 1.11 you'll find in once in Zend/Serializer/Adapter/PhpCode.php on line 59, in a method that unserializes stored PHP code. The method isn't a part of the MVC architecture, db component, and actually isn't used anywhere else in the framework (Zend_Serializer_Adapter_PhpCode isn't instantiated anywhere else in the code base).

So if eval breaks your ZF-Hip Hop app, don't use Zend_Serializer_Adapter_PhpCode, or eval in your consumer code.




回答6:


Simple answer: I don't think it would.

Just saw this on hiphop page: https://github.com/facebook/hiphop-php/wiki/

"You keep coding in simpler PHP, then HipHop executes your source code in a semantically equivalent manner and sacrifices some rarely used features – such as eval() – in exchange for improved performance."

Did a search for 'eval' on ZF 1.9 and there are over 100 occurrences.



来源:https://stackoverflow.com/questions/2190270/can-i-use-facebooks-hiphop-with-frameworks-like-zend-framework-cakephp-symfon

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