开发者

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

开发者 https://www.devze.com 2022-12-19 13:54 出处:网络
Yesterday Facebook launched HipHop, a sourcecode-converter from php to c++. The set of php funct开发者_如何学Goions and constructions is more limited than in standard php.

Yesterday Facebook launched HipHop, a sourcecode-converter from php to c++. The set of php funct开发者_如何学Goions 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?


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 ;-)


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/


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.


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 ;).


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消