3 ms·
While I often use the PHP integrated webserver during development: php -S 0.0.0.0:8000 public/index.php it is single threaded, slow and therefore not made f
by sandreas 2y ago
While I often use the PHP integrated webserver during development:
php -S 0.0.0.0:8000 public/index.php
it is single threaded, slow and therefore not made for production environments. FrankenPHP looks promising, while the issue with limited Cores / Threads[2] seems also to be a problem when using it in production. However, maybe I'll give it a go for my pure-todo[1] project and see, if it suffers the same problem. The docker image as base looks really promising. Thanks for sharing.
1: https://github.com/sandreas/pure-todo https://github.com/sandreas/pure-todo
2: https://github.com/dunglas/frankenphp/discussions/294 https://github.com/dunglas/frankenphp/discussions/294
- 20after4 2y ago>it is single threaded, slow and therefore not made for production environments. I'm pretty sure that this solves those specific issues (and more)
- lpapez 2y agoThe PHP built-in server is explicitly stated not for production use, and is intended for development purposes only. See the warning at the top of the page: https://www.php.net/manual/en/features.commandline.webserver.php https://www.php.net/manual/en/features.commandline.webserver... Not sure it's even fair to consider it for comparison in this context.
- sandreas 2y agoThat's what I meant. But tbh I don't think FrankenPHP is ready for Produktion yet, although it might geht there some day. Just wanted to mention that using PHP locally, for simple app development you don't need a full fledged nginx, Apache or caddy in all cases
- PetahNZ 2y agoYou can set PHP_CLI_SERVER_WORKERS to make it run multiple threads.
- sandreas 2y agoNEAT, didn't know that. Would still not use it in production :)
- pierstoval 2y agoFrankenPHP is just Caddy + PHP, but in one binary. The threads thing, the worker mode, etc., all of it is optional, but basic Caddy + PHP is already production-ready, I've been using this kind of setup for a while, and switching to FrankenPHP when you already have Caddy is completely harmless. The only thing FrankenPHP does not is providing multiple versions of PHP in the same binary. For that, I'd still use Caddy + PHP-FPM, and it's fine.
- rakoo 2y ago> not made for production environment Out of curiosity, is the performance the only blocker for putting this in prod ? If I were to have a small site, intended for a small number of users, what would I miss from other "prod-ready" environments ?
- slim 2y agoit's really just for testing. Like for example you can't have a "." (dot) in a URL because it would be interpreted as a static file.
- rakoo 2y agoOk, that's a good thing. I'm more interested in arguments than in "it's just for testing", because the latter doesn't indicate what's the problem (and what prod-ready solutions solve)