We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

Phalcon and HHVM together...

I've heard a lot about the possibility of having Phalcon run on hhvm. According to Phalcon's developers this would be extremely difficult (if not impossible) because Phalcon is built specifically for Zend Engine. Phalcon should run faster than any other framework "compiled" with hhvm. Its logic: Phalcon is pure C(++ ?), whereas hhvm woud take the php code and compile it just in time to a code that runs on the hhvm which runs on C++. So, why woud you want Phalcon run on hhvm?

The good news is that you can actually have both with an easy-to-implement architecture. See, you setup your apache or nginx server to run with php 5.5 and use Phalcon for your the most dynamic parts of your project. If you have part of the process that's really memory intensive package that php as a separate class or library, don't put heavy code in controllers, controllers are meant to be light.

Now that you have your heavy code in a separate class or library (not accessible to the public, of course) simply run a shell_exec to that file but instead of using php call it with hhvm, yes hhvm runs from the command line.

Other things to consider: it's possible but unlikely that hhvm takes ZendEngine as the de-facto php run engine. Only if they would make it so most php extensions run on hhvm then I'd say that hhvm has a real chance of take over. But think about this: Facebook has been playing with hhvm for at least 3 years and they still can't make it compatible with the main frameworks. They alleged having achieved at least 90% parity with the main frameworks but what they did was running automated tests. We know that actual implementations of the framework with hhvm don't work. So give them another year to achieve real-world parity. Then give them another year to bring the documentation up to par, and another year to clear all internal corporate policies. By then the ZendEngine will be as or close to as optimized as hhvm. Bottomline: My recommendation (and I'm actually telling this to myself) is to no fret and start using Phalcon (it simply rocks!) and wait for the dust to settle around hhvm. Using my approach above, you can have the cake and eat it too! (Hint: you can do the same with nodejs or even java ;-) )

I cannot see hhvm replacing zend engine. You are right in the statement that in two-three years ze will be much faster and it will probably still have some room for optimization when hhvm might actually be pushed to its limit. Another argument here is that many 3rd party extensions, database drivers, cache driver and so on would need to be rewritten for hhvm if it was to replace current core. I've mentioned this somewhere before, but I still think it would be better for everyone if Facebook with its budget could invest in Phalcon. If one day PHP goes completely object oriented and drops named functions and global scope a huge effort would be required to keep hhvm compatible where (I believe) adopting Phalcon won't be that difficult.


As far as I heard from other developers with experience in HHVM, they have troubles with many other components written for Zend Engine and not available in HHVM. (i.e. gettext) The HHVM team is already working on a Zend compatibility layer to solve this issues, Hopefully this compatibility layer can support advanced components like Phalcon in the near future.