4 ms·
The phrase "shared nothing" springs to mind. Years ago (1999?) one of the early PHP bloggers had written that PHP was good precisely because of 'shared nothing
by mgkimsal 8y ago
The phrase "shared nothing" springs to mind.
Years ago (1999?) one of the early PHP bloggers had written that PHP was good precisely because of 'shared nothing' architecture. There was no shared memory, no threads, etc to trip you up.
Years ago, and colleague bitched about PHP, and one of the issues was 'no thread support'. I went to pick him up for lunch one day, but he couldn't make it - 'debugging some threading issues' (in either java or c++ - can't remember which one). I... didn't quite bite my tongue, and, while I know 'different tools for different jobs' makes a lot of sense, I also know many people have made more work for themselves by explicitly avoiding even greenfield projects in PHP because... well.. because it's PHP.
Also, from what I gather, PHP will be getting real async support in a couple years, which may throw some of the 'ease of thinking' arguments out the window a bit.
- sneak 8y agoPHP has hundreds of legitimat reasons for professionals to avoid using it aside from the fact that writing multithreaded code is hard.
- madaxe_again 8y agoThere has been threading in PHP via the pcntl_ functions for a long while - since PHP4. You have to have some pretty exotic needs to want to use them, but threading does exist, and I’ve built a multithreaded php app using it.
- gnarcoregrizz 8y agoThe needs aren't very exotic. You can use them any time you need to do multiprocessing, a common example is building a daemon to process a queue in parallel with multiple workers. Also, the pcntl functions don't provide multithreading primitives, only multiprocessing (fork) Edit, looks like there is also a pthreads extension
- codedokode 8y agoBetter solution might be to run several daemon processes in parallel.
- Shish2k 8y ago> The needs aren't very exotic [...] a common example is building a daemon While "writing a daemon" is pretty common, I've never seen a daemon written in PHP (I'm sure they exist, I've just never seen one), so I would call that an exotic use-case :P
- aequitas 8y agoI had to maintain one, would not recommend it as a general pattern. Most of the problems might as easy have to do with the original author and his experience in writing such an application (and hence choice of PHP for this task). But this post also springs to mind: https://software-gunslinger.tumblr.com/post/47131406821/php-is-meant-to-die https://software-gunslinger.tumblr.com/post/47131406821/php-...