4 ms·
I wrote a preforking webserver in PHP once [1], it was a lot of fun! Especially since there wasn't really anything apart from FastCGI and mod_php. I have always
by lgierth 13y ago
I wrote a preforking webserver in PHP once [1], it was a lot of fun! Especially since there wasn't really anything apart from FastCGI and mod_php. I have always been wondering why there weren't more PHP webservers written in PHP, maybe because FastCGI and mod_php were just good enough for everybody? Contrast that to the Ruby community, where there are more than a dozen decent webservers, implementing varying concurrency models.
Very interesting project!
[1] https://github.com/lgierth/pint https://github.com/lgierth/pint
- X4 13y agoGood point. Gives stuff to think about.
- kijin 13y agoIt's probably a mix of (1) "If it works, don't fix it" and (2) "I don't give a shit." (1) Because Apache has had mod_php for ages, and there's FastCGI/FPM for everything else. If you already have something written in C that works out of the box, there's little incentive to write an alternative in a slower language. Besides, until recently, PHP has been woefully inadequate for writing daemons, with all those memory leaks and crappy error handling. Even nowadays, there's a lot of stigma against writing daemons in PHP (usually by people who still think in terms of PHP 5.2). (2) Because the majority of PHP programmers are not interested in writing anything other than plain old PHP scripts accessed with a browser. This might be a result of the fact that almost everyone has standardized on either mod_php or FastCGI/FPM. When something is taken for granted for such a long time, you tend not to think about how the lower layers works at all. At least in some circles, it's not unusual to encounter "experienced" PHP programmers who are surprised to learn that they can run a PHP script from the CLI and keep it running for many days.