Hacker Newsnew | past | comments | ask | show | jobs | submit | zexias's commentslogin

The PHP doc advices you that the built-in server from PHP should be used only for development: https://www.php.net/manual/en/features.commandline.webserver.... But PHP-FPM is the most used nowadays, for sure.


I find the built-in web server very useful for running tests. Instead of setting up Apache or nginx on every CI build, you just fire up the built-in web server and point your tests at it.


I use it for small scripted jobs on my own machine that have to go through a proxy, I start the built-in server on the proxy root and point the script to the localhost address.


That is not a problem with PHP itself, but the way that Apache/Nginx operates PHP. However, if you want to go full PHP, there is this extension that is pretty amazing (has a built-in server on it and more): https://www.swoole.co.uk/

ps: https://github.com/swoole/swoole-src/issues/1401 some performances benchmark (they compare it even with golang)


Does Swoole have any comparison to roadrunner (https://roadrunner.dev/)?


I tried many things from Apache with mod_php, nginx with php-fpm, Roadrunner and Swoole.

Apache and nginx are both great, both have pros and cons, although I would go with nginx and fpm as my first choice.

Swoole is totally different approach as it runs php as standalone server in a loop, just like python for example. It is great if you serve api but it kills the benefit of having each request isolated as you would have with nginx or apache. So you need to care about memory leaks, db connection pools etc. Also Swoole docs was not great few months ago.

Roadrunner is kind of between apache/nginx and Swoole. It is a golang server that can execute php in workers. For each worker once php is loaded it will stay in memory and it is super fast. The only downside on this one is that Roadrunner is developed by mostly one guy and not much you can find on the internet. Also Roadrunner features set is IMO very narrowed into what the company behind it needs at the time. IMO there is no clear vision where this project is going.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: