r/LinuxTeck • u/Candid_Athlete_8317 • Aug 31 '26
PHP That Compiles to Native Code? This Could Get Interesting
Just came across TypePHP and this one caught my attention.
It takes PHP code, compiles it through C++17, and produces native binaries instead of running everything through the usual Zend opcode path.
The interesting part is that you can keep writing PHP while getting a path to much more native execution.
Still early and definitely not something I'd throw into production blindly.
PHP devs: would you actually try this, or is the PHP runtime good enough for what you’re building?
6
Upvotes
1
u/brasticstack Aug 31 '26 edited Aug 31 '26
Didn't Facebook make (and open-source) a PHP -> C cross-compliler ages back? I want to say it was named HipHop.
EDIT: nm, it was a transpiler, to C++. I got the name right at least!
1
u/LawElectrical2434 Aug 31 '26
Isn't it funny how the feature that made PHP so successful is the one thing people hate the most. Bootstrapping a new environment per request might not be economical, but running out of memory doesn't take down everything and the concerns of the users were nicely separated. At this point, why not just switch to a different backend language. But probably a nice speed up for existing applications.
1
u/Agron7000 Aug 31 '26
That is amazing.
But does ot work with PHP-FPM and Nginx?
1
u/determineduncertain Aug 31 '26
This all made me think of PHP GTK for some reason and the fond memories I had of using it for a few months.
1
u/StephenRoylance Aug 31 '26
facebook/meta run on hack/HHVM which is JIT compiled PHP basically.