from Hacker News

Show HN: FrankenPHP, an app server for PHP written in Go

by kdunglas on 10/14/22, 3:59 PM with 83 comments

  • by pbowyer on 10/14/22, 7:22 PM

    Good. PHP-FPM needs a challenger as anyone who has tried to debug it or its pools knows. Or to tune it (so many modes, so many configuration options).

    Litespeed's PHP LSAPI [1] shows how good performance can be with other setups. It'll be great if FrankenPHP gets to the same state.

    1. https://www.litespeedtech.com/open-source/litespeed-sapi/php

  • by abrztam on 10/14/22, 7:31 PM

    What is the difference between this and Roadrunner? It seems to do the same stuff.

    https://github.com/roadrunner-server/roadrunner

  • by 0xbadcafebee on 10/14/22, 6:16 PM

    So it's mod_php for Caddy, in reverse?

    The traditional idea is to build a plug-in for the parent webserver. By essentially "making a fork" of Caddy, if you want to add other plugins to Caddy and then incorporate them into FrankenPHP, it's a lot more work. If instead you ship a PHP plugin to Caddy, you can manage Caddy instead and mix and match different functionality in one place.

    But I guess it's heretical to suggest somebody use plugins in Go, if the whole idea is everything is a static binary.

  • by b_sanchez on 10/16/22, 3:02 PM

    I was in the conference (20221014, afup 2022), where frankenphp was released live. The conference was really interesting and answer many (if not all) of the questions raised in comments.

    I'v checked and unfortunately the video recording is not available for now, I will post a link here as son as available.

  • by p4bl0 on 10/15/22, 10:47 AM

    If I understand it correctly the idea of worker mode is to have a persistent application running where you can have the same objects in memory from one request to another rather than relaunching the app from scratch (requiring files, constructing objects, fetching data from some database) again for each request.

    Is that it?

  • by borancar on 10/16/22, 10:56 AM

    This is amazing, and way more advanced than what was there. Going to definitely use it on the next project.

    Previously, there was https://github.com/deuill/go-php which was PHP5 and PHP7, but you needed to build PHP with ZTS. I had to forke it to focus on PHP5 and bring some improvements - my primary goal was to port some legacy PHP over iteratively via the Strangler pattern. If it can still be useful to some, the fork is here - https://github.com/borancar/go-php

  • by NorwegianDude on 10/15/22, 8:20 AM

    Not really sure what the pros of this is. Simple to deploy in a docker image? Didn't know that was an issue. I guess performance also takes a hit, and that worker mode is a good amount slower than Swoole?

    Some benchmarks against mod_php, nginx+php-fpm and swoole would be nice.

  • by timw4mail on 10/14/22, 4:48 PM

    So after looking at the slidedeck on the authors blog, I'm rather confused. How does FrankenPHP keep the code in memory if each request is in a separate memory space?
  • by nobleach on 10/14/22, 4:57 PM

    I've been watching how Go and Rust tooling has been finding its way into the JavaScript ecosystem. I've been out of the PHP realm for about 10 years but I did find RoadRunner for PHP at one point. That's also an app server written in Go I believe. I wonder how this compares.
  • by seabrookmx on 10/14/22, 4:43 PM

    So.. it's like gunicorn (pre-fork web server) but for PHP and built on top of Caddy?

    Looks neat!

  • by jeffersonheard on 10/14/22, 7:12 PM

    If this isn't pronounced Frankenphip I will be disappointed.
  • by tiffanyh on 10/14/22, 5:43 PM

    I might be missing the obvious but why would you add extra complexity to your infrastrucutre setup when PHP can be run natively from within caddy, apache, nginx via fastcgi.
  • by codegeek on 10/14/22, 6:17 PM

    I see a bit of C as well ? Also, do we need to use Docker ? I am very interested in trying but wanted to check.

    If it is Go, can I not just compile the binary and execute ?

  • by nonoesp on 10/14/22, 5:58 PM

    It'd be great to see how a Laravel app could run on FrankenPHP and see if there are speed gains.

    My current setup is a DigitalOcean Droplet with Nginx and php-fpm.

  • by simlevesque on 10/14/22, 5:09 PM

    Félicitation !

    Do you have any success story with this application server ?

  • by treahauet on 10/14/22, 6:52 PM

    Congratulations! This looks neat!
  • by green-salt on 10/14/22, 4:54 PM

    I'll have to try this out!
  • by chx on 10/14/22, 5:10 PM

    Looking at the forked PHP source https://github.com/php/php-src/compare/master...dunglas:php-... I do not expect compatibility issues.
  • by k__ on 10/14/22, 7:00 PM

    PHP is already FrankenPerl, and Perl FrankenAwk?

    What happened to the times where some crazy person would simply slap together an interpreter and call it a language?

    Somehow, language creation got more and more sophisticated these days.

  • by password4321 on 10/14/22, 6:59 PM