3 ms·
There is nothing to stop you writing persistent PHP socket servers and there are many examples out there. A quick and easy to digest example of an implementati
by xd 13y ago
There is nothing to stop you writing persistent PHP socket servers and there are many examples out there.
A quick and easy to digest example of an implementation of memcached in PHP: https://github.com/AndrewRose/cached.php https://github.com/AndrewRose/cached.php
- astrodust 13y agoYeah, like I'm going to use that in a production environment. The libevent bindings are pretty wobbly in most languages other than C, with the exception of things like NodeJS. Plus, that project is pretty much abandoned.
- xd 13y agoIt's an example of what can be done. And yes libevent has been abandoned but has also been superseded by http://us3.php.net/event http://us3.php.net/event Your attitude is very insulting, did you know that? You have an obvious lack of understanding of the PHP ecosystem yet feel you can belittle it with off the cuff comments at will. Please stop this behavior as it drags the entire developer community down.
- astrodust 13y agoI've been spending a lot of time in the "PHP ecosystem" and honestly it's a disaster. It's comparable to a country like Brazil. In some areas people are very well off, they have developer tools, they have best practices, they produce useful, workable code. Yet they're the elite minority. Most people have nothing, get by with scraps of code scavenged from message boards or obsolete technical books, and bang together applications that are the code equivalent of a barrio. The level of ignorance about even the most rudimentary things like SQL escaping or string concatenation vs. interpolation is staggering. Let me be honest, I don't care if I'm insulting. I'm not saying these things to make friends or win karma. I'm saying them because PHP has problems and I don't see a lot of effort being made to reach out to the average developer learning PHP who's stumbling along, all wrong if only because they don't know better and nobody's telling them otherwise. I'm not going to suggest that other communities don't have problems, Ruby has a standard library that's embarrassingly bad, Python has a version schism they're at a loss to resolve, NodeJS is being held back by the crippling limitations of the V8 engine, but PHP is all that and more. For example, if you're working on a complicated C++ application and need a simple script to emit some templated files you could roll this in Python, Ruby or even Perl and a seasoned developer would be okay with that. If you wrote it in PHP, though, they'd have reservations. Why, of all the scripting languages out there, would you pick that one? Why is PHP such an albatross? I spent a lot of time in the Perl community back when it was still a thing and witnessed what happened to a language when people didn't complain or, as you say, insult it enough. Unconditional love isn't a bad thing when dealing with people, I'm all for things being civilized, but it's toxic when applied to programming languages. You love your pet language too much and you'll smother it, every time. Smalltalk suffered greatly because of this attitude, people pretty much loved it to death. You want your favorite language to evolve? Be its worst enemy. Find things about it you hate so much you can't stand to endure them any more and fix them. Bitch about things that aren't right, take a stand, and be the squeaky wheel. Every time I get into one of these discussions about PHP with someone who seems to be a big supporter of the language, I ask for one thing: Don't just tell me PHP is great, show me. Is there a guide to PHP better than PHP the Right Way (http://phptherightway.com/ http://phptherightway.com/) that encourages people to do things correctly so they can have an experience like yours?
- xd 13y agoNice rant. But it doesn't change the very simple fact that you have been spreading ignorance in regard to PHPs capabilities. You also show nothing but a very subjective view of PHP based on, what I can only guess at, is your own gut feelings.
- astrodust 13y agoOn the contrary, I've been doing what is as much as "Doctors Without Borders", trying to get new developers on Stack Overflow using PHP to stop doing things that are damaging. There is a non-stop influx of those that have almost no idea what they're doing, and no idea where to turn for help, composing these desperate pleas to explain what's often something so elementary nobody bothers to discuss it. I don't know how many hours I've spent answering simple questions and promoting incrementally better practices, but it's got to be in the hundreds by now. I'm not even a PHP developer, I'm only focusing on the intersection between PHP and MySQL where a lot of deadly dangerous mistakes can be made, and there's not much in the way of push-back when you're going horribly awry. Perhaps this gives me the perspective of someone working in the emergency room, where everyone seems to be on the brink of death, which is not at all like the real world. I can only report on what I'm experiencing. If there were better resources I could link to as a sort of intervention, to help mitigate how bad this can be, I'd like to know. Right now it's like a never-ending stream of new coders with some serious MySQL escaping issues that they don't know about and problems related to the completely awful training material they've been exposed to. If you think I'm exaggerating, just look at the sorts of questions that show up constantly and demonstrate how real-world PHP developers are producing code. Examples are so rife you can barely find a question without serious problems: http://stackoverflow.com/questions/20252023/how-to-create-automatic-page-using-php-uplaod-script http://stackoverflow.com/questions/20252023/how-to-create-au... is all too typical. Why are people writing code this way? This does not happen in the Python or Ruby worlds. You'll get ambushed by people who will coach you in how to use Django or Rails.