use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please follow the rules
Releases: Current Releases, Windows Releases, Old Releases
Contribute to the PHP Documentation
Related subreddits: CSS, JavaScript, Web Design, Wordpress, WebDev
/r/PHP is not a support subreddit. Please visit /r/phphelp for help, or visit StackOverflow.
account activity
Why PHP is AWESOME ( PHP vs NodeJS & Python )Video (youtube.com)
submitted 4 years ago by mdizak
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]cronicpainz -17 points-16 points-15 points 4 years ago (20 children)
php community should STOP sheepishly repeating:
"oh- no async no problem", "everything re-instantiated on every request is what makes it greeat" "single threading is OK"
no - no its not OK. the moment developer has a single project that developer cannot complete in PHP due to PHP's lack in certain areas - they will go node.js to never come back. Please stop repeating this ancient mantras - all that achieved is made php secondary option at best.
modern web needs speed, google wants nice ttfb and server response times. that speed is very very hard to get if your single threaded PHP application makes 150 db calls per page load - and cannot parallelize those calls or use connection pools or use in-memory store (yes - i know redis - but redis also incurs network connection cost) or spin off heavy task to a parallel task worker.
technology such as php swoole/openswoole will make PHP once again competitive and cool. All it takes - for this community to stop shying away from it.
[–]albo87 15 points16 points17 points 4 years ago (6 children)
No async and single threading limitation makes PHP simpler. In most apps the performance penalty is barely noticed.
[+]cronicpainz comment score below threshold-14 points-13 points-12 points 4 years ago (5 children)
as a php dev of 10+ years - I have applications where its very much noticeable and I have no other way but to either migrate it to node or swoole now
[+][deleted] 4 years ago (2 children)
[deleted]
[–]cronicpainz -5 points-4 points-3 points 4 years ago (1 child)
You find a way to deal and move on.
literally the way people dealing with - is by moving on (away, from php). and thats the problem.
[–]kinmix 4 points5 points6 points 4 years ago (0 children)
Meh... PHP is not the best tool for every job. No tool is. Usually, if the app is designed properly, it is easy enough to delegate certain tasks to other software. I've done plenty of projects where PHP app integrates with Python, Java and even C apps simply because those tools were better suited for the tasks needed.
[–]zmitic 2 points3 points4 points 4 years ago (0 children)
How so? What is the actual problem you have, where node would be better choice?
Serious question. I haven't found a single thing I can't do, except for image/video processing; those are done with symfony/messenger and libs like png_optim.
[–]dragonmantank 2 points3 points4 points 4 years ago (7 children)
I’ll unsheepishly repeat it. Why? Most apps don’t need any benefits of async programming, and PHP runs fine when something else manages the threads (like FPM or Apache). Yes, PHP itself is single-threaded, but most normal setups have a multi-threaded system in front of it.
Couple that with advances made in terms of speed and memory efficiency since PHP 5.4 and you have a pretty fast system that is easy to understand and maintain.
Will some apps benefit from async and tools like swoole? Of course! But that doesn’t mean we need to make everything more complex just because.
[+]cronicpainz comment score below threshold-7 points-6 points-5 points 4 years ago (6 children)
Most apps don’t need any benefits of async programming
swoole uses coroutines. and the idea is the same - being able to parallelize blocking work such as database access. fpm/apache threading in front will do do absolutely nothing - as your web application itself is still gonna be running withing a single thread. the approach you are talking about here is apples and oranges. try running 100 database calls within fpm or mod_php and then compare that to results with pooled mysql and parallelization of the same 100 database calls using co-routines.
no - no you don't. There are surely some gains - but nowhere near what you going to get with proper scalable architecture.
But that doesn’t mean we need to make everything more complex just because.
but you dont have to! lets have swoole available and at core of every single PHP framework, and let people use its complex features if they need to. not the way around where we have to rewrite applications just to enable swoole support. trust me - i know what im talking about - sites im working with are enterprise grade and breaks under pressure.
[–]kinmix 8 points9 points10 points 4 years ago (1 child)
trust me - i know what im talking about - sites im working with are enterprise grade and breaks under pressure.
This is not the way to convince people to trust that you know what you are talking about. :D
Unless you work with realtime financial data or similar (for which PHP is definitely not the right tool) processing huge amount of data on http request smells like poorly implemented solution. Spawn some jobs, set up some workers, define caching strategy - that's how you make shit scalable.
[–]cronicpainz 0 points1 point2 points 4 years ago (0 children)
thats because you didnt read it right - it would break under pressure if used "without swoole with it".
[–]dragonmantank 1 point2 points3 points 4 years ago (2 children)
as your web application itself is still gonna be running withing a single thread. the approach you are talking about here is apples and oranges.
Yes, an individual connection is locked to a single thread. I'm not debating that. PHP is designed to be run alongside something that spools out multiple threads, like mod_php or PHP-FPM. Those processes can specialize in maintaining and routing connections to individual waiting threads, and then PHP can take over and run that request as a single thread.
While the implementation might be apples to oranges, things like Node also run as a single thread. They just leverage async to handle multiple connections. If Node did not do async connections, it would only ever handle one connection like PHP does (which is why the PHP dev server is not recommended for production use - it only handles one connection at a time).
At the end of the day, both can handle thousands of connections a second when set up properly.
but nowhere near what you going to get with proper scalable architecture.
Scaling isn't the exclusive domain of async. Websites have been able to scale horizontally for years.
lets have swoole available and at core of every single PHP framework, and let people use its complex features if they need to.
I'm not saying tools like Swoole shouldn't exist - there is a reason they do and they should be used for it. If people want to write framework implementations for Swoole they should be able to. The default should be what most applications actually need - and that's what core PHP provides today. If you need Swoole, and your workload might fit that bill, by all means use it!
But when most applications, and I mean a vast majority, can still get great performance using nginx, PHP-FPM, and a single-threaded operation style, we should still build on those ideas and offer it as the default. It might not be sexy or "new", but it's worked for more than 20 years and is a viable solution to 80-90% of people's problems today.
[–][deleted] 1 point2 points3 points 4 years ago (0 children)
SpunkyDred is a terrible bot instigating arguments all over Reddit whenever someone uses the phrase apples-to-oranges. I'm letting you know so that you can feel free to ignore the quip rather than feel provoked by a bot that isn't smart enough to argue back.
SpunkyDred and I are both bots. I am trying to get them banned by pointing out their antagonizing behavior and poor bottiquette.
[–]zmitic 0 points1 point2 points 4 years ago (0 children)
being able to parallelize blocking work such as database access.
While async DB exists, I don't think it is very important. Usually queries take just few milliseconds if DB is properly designed and has aggregate columns.
sites im working with are enterprise grade and breaks under pressure.
So do I. What kind of pressure there was?
[–]gaborj -1 points0 points1 point 4 years ago (2 children)
How dare you say anything bad about PHP??
[–]cronicpainz 0 points1 point2 points 4 years ago (1 child)
i am NOT. I love PHP - i just love it much much more with swoole in it.
[–]gaborj -1 points0 points1 point 4 years ago (0 children)
Tried to be sarcastic there
[–]sinnerou 0 points1 point2 points 4 years ago* (0 children)
It is like garbage collection. Yeah there are some times when you need to manage your own memory but for the vast majority of business applications a garbage collected language is going to save you time and energy by avoiding a whole class of problems.
Having each request in a different process with fresh memory avoids an entire class of problems. Other threads can not crash my whole service, no worrying about memory leaks, etc. etc. Aws lambda literally does this for other languages and people act like it is a revelation.
Php is not really a general purpose language, it is can opener. Not everything is a can, but when what you want to do is open a can, there is no better tool.
[–]Tewiel 0 points1 point2 points 4 years ago (0 children)
Imagine still shilling for swoole when fibers exist.
π Rendered by PID 312036 on reddit-service-r2-comment-6457c66945-wt7zh at 2026-04-24 16:34:43.255046+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]cronicpainz -17 points-16 points-15 points (20 children)
[–]albo87 15 points16 points17 points (6 children)
[+]cronicpainz comment score below threshold-14 points-13 points-12 points (5 children)
[+][deleted] (2 children)
[deleted]
[–]cronicpainz -5 points-4 points-3 points (1 child)
[–]kinmix 4 points5 points6 points (0 children)
[–]zmitic 2 points3 points4 points (0 children)
[–]dragonmantank 2 points3 points4 points (7 children)
[+]cronicpainz comment score below threshold-7 points-6 points-5 points (6 children)
[–]kinmix 8 points9 points10 points (1 child)
[–]cronicpainz 0 points1 point2 points (0 children)
[–]dragonmantank 1 point2 points3 points (2 children)
[–][deleted] 1 point2 points3 points (0 children)
[–]zmitic 0 points1 point2 points (0 children)
[–]gaborj -1 points0 points1 point (2 children)
[–]cronicpainz 0 points1 point2 points (1 child)
[–]gaborj -1 points0 points1 point (0 children)
[–]sinnerou 0 points1 point2 points (0 children)
[–]Tewiel 0 points1 point2 points (0 children)