4 ms·
Outside of the prefork mode (which cannot compete even with just FPM/Apache mod), this has a bunch of isolation issues that I don't see mentioned anywhere; name
by confusedbucket 7d ago
Outside of the prefork mode (which cannot compete even with just FPM/Apache mod), this has a bunch of isolation issues that I don't see mentioned anywhere; namely statics in functions (often seen as a request-lifetime cache in PHP), typed statics without defaults, define(), $_ENV, setlocale(), ignore_user_abort() or mb_internal_encoding() just to name a few. It also assumes all function/class declarations are guarded, so this isn't a drop-in replacement for a webserver that "just works"; for most code, it probably doesn't, so the "unmodified PHP" claim seems like a stretch.
EDIT: After reading through the fairly long README, this is mentioned. So you either use the provided server API to make it fast, or use the CGI mode - even for WP, Laravel or Symfony ("legacy", really?)). It'd be better advertised as a framework, using which is the only way to actually achieve the promised results.
I'm also a bit confused by the webserver code itself; it's PHP 5 code (with all the @class and @private annotations, even) that targets 8.1 (EOL) and yields deprecation notices on PHP 8.2.
The taken approach is interesting, but I'd not put this in front of anything that matters.
If you're this uncomfortable with having to run a webserver, but comfortable with a vibecoded webserver, consider switching to Go, .NET or any other stack where you don't have to fight the PHP's inherent shared-nothing model.
- EGreg 7d agoActually, there is a “fork” mode that outperforms php-fpm by about 100x. That is, it allows the webserver to spawn 100x more processes on the same machine (tested) on Linux and Mac. The trick is that the pcntl_fork() is done after loading the classes, so because the OS does copy-on-write of memory pages, each child process takes up maybe 4-200KB. One 4GB machine can handle 40,000 simultaneous users. This fork mode is exactly for the type of unmofoeid code you’re talking about — which may have some thing not reset between requests. It is still capable of 10-100x more throughout than PHP-FPM, even in its “prefork” mode. This is a “post-fork” if you will. The code is compatibke with PHP all the way down to 5, so this webserver can be run on any PHP environment from the last 15 years.