Hacker News new | past | comments | ask | show | jobs | submit login
Rambling On [PHP] Internals (ircmaxell.com)
184 points by chrisacky on Sept 6, 2013 | hide | past | web | favorite | 165 comments

The author is complaining about lack of vision, leadership and regulations. And most of us can perfectly understand that, except: those are exactly the things that set PHP apart from most other major open source projects.

It is by far the most anarchic and disorganized major OSS project and yet it still thrives. It still moves forward, it still gets better. Yes, it's design foundations as a language are not particularly elegant (to put it mildly), but that's pretty much the only major thing that's wrong with the resulting product.

According to all known wisdom about how an OSS community should function, PHP should have imploded and forked a long time ago. It should no longer exist.

And yet, despite this "I quit" rant, PHP has had relatively few major conflicts. The PHP way is unique, and while it may offend the sensibilities of people who like a nicely organized and disciplined community ran by a benevolent dictator or inspiring visionary, dammit, it works.

I strongly suspect that any successful attempt to solve PHP's organizational "problems" would actually result in killing it stone dead.

We already have Python and Ruby ea. PHP should stay weird.

As I was reading the article I was just thinking about how so many projects have exactly the type of leadership, vision and reputation norms that he wishes for in the PHP project, and the result is that people complain that project is elitist or unapproachable. In php-internals maybe you have to run with the bulls to get something done, but at least its accessible.

Death by a thousand cuts is still a death (and a slow and painful one at that). I'm hopeful that this is just the kick in the pants the project needs to get its act together.

It's unquestionably gotten better in recent years, but it still has a long and seemingly never ending list of warts. I don't see PHP getting forked anytime soon, but I do see developers moving to other languages routinely. And that's a shame since PHP is still, for better or for worse, the easiest language to get into for the novice.

PHP as an emergent phenomenon that is forcefully evolved by the sheer amount of need presented by the massive user base, in which any large scale forced reorganization would break the cycle and cause it to die (or at least fork)?

I can see that.

Keep PHP weird. Love it :)

I suppose forking PHP is as realistic as forking Perl :)

Also i can imagine two major reasons PHP is not forked:

1) You have a small committed developerbase which is too much invested in the ecosystem (Zend and others).

2) Every other user (aka webdeveloper and PHP developers that want a major change) in the ecosystem may rather move on to another language then try to fork it. In the end: What what you do with a PHP fork that doesn't move in the direction of Ruby, Python and Co.?

Beached whales take a long time to die. I think these are signs that PHP is dying, not thriving.

Killing PHP dead would be as hard as killing IE6 was.

Much harder, I'm afraid.

I read php-internals every day, and.. this is totally understandable. There's a lot of opinionated people on that list with totally different visions - nikic, stas, that one guy Lester who is convinced 5.3 and E_STRICT was the worst thing in the world... PHP just appeals to too many people to have a consensus. Possibly the point this was made most clear was when the property accessors RFC was declined on a hairpin vote despite having a majority (and the time that switching to an actual AST-based parser was a non-starter).

Your contributions and voice will be missed.

>that one guy Lester who is convinced 5.3 and E_STRICT was the worst thing in the world

Ahahaha, it's all coming back now. I used to find his emails funny.

I also remember why I unsubscribed from php-internals as well, though...

An eyeopener for me was reading parts of the discussion how the new namespace seperator was chosen: http://pastebin.com/2iJP4Qhx (from https://wiki.php.net/rfc/namespaceseparator)

If you read that IRC log and truly believe that a multi-million/billion dollar ecosystem/environment should be ruled by what reads like kids between 12-16 chatting, then go ahead. I won't. Apart from that there is enough rant on PHP on the internet already ;)

Subscribe to it for awhile and you'll see.

It also turned off the suhosin author to the point where he moved onto other stuff.

He had some great ideas, now lost (no longer works with PHP > 5.3 )

But Zend shows up and folds back in some great stuff into PHP once in awhile.

Take a look at their now opensourced opcode cache, it's faster than all others.

> But Zend shows up and folds back in some great stuff into PHP once in awhile.

That's kind of the exception instead of the rule, really. Andi and Zeev are very, very infrequent contributors to php-internals.

They proposed releasing the thing that became opcache after Rasmus finally convinced everyone how much of a pain in the rear end maintaining APC was.

This is super relevant. How to protect your open source project from poisonous people.


That's extremely helpful advice.

The video to those slides : https://www.youtube.com/watch?v=ZSFDm3UYkeE

They also have a few other talks on youtube about similar topics and a book now: http://shop.oreilly.com/product/0636920018025.do

I'd often wondered if the patchwork, self-contradicting, non-standard, anarchistic nature of PHP was a reflection of the mind-set of the creators.

I'll give you that. No clear direction. As I thought about this a little more in Ruby you have Matz, Python has Guido, Scala has Odersky, C# has Anders (those are just those that come to mind and I'm not sure of the current involvement). I can't think of who PHP really has like this. Rasmus maybe, but I don't think it's the same as the other languages I mentioned--understandably so due to other projects/engagements.

Any large community has these problems. This is the advantage to using forum engines that allow non-anonymous upvotes/downvotes over a naive mail-list - people can silently agree and separate the wheat from the chaff, and consensus becomes far more visible. You can even give the important contributors greater "weight" to the ups/downs (this is not a democracy, contributors are worth more).

All the "forum" software that I have seen (opposed to more "ephemeral discussion" software like HN/Slashdot/Reddit) provides such a goddamn awful reading/browsing/discoverability experience that any benefits it may have over mailing lists are completely lost. Just for starters, mailing lists allow the discussion to thread (as do sites like HN, Slashdot, and Reddit) and don't force you to use a shoddy web interface that shows you only a few dozen posts on a single page. If I have to scroll to the bottom of a page and click a link that says "513", I am having a bad day.

I have never seen a large open-source project that uses "forums" in a way that doesn't impose massive overhead. Without fail, forums for open source projects are dreadful while mailing lists are, with a few notable exceptions, pleasant. When I am looking for information about a project and discover that all the project officially has is a forum, my heart sinks; it ranks up there with finding out the project is still hosted on sourceforge or a mega/rapidshare/whatever clone.

Every time I'm forced to use a forum for something, I wish usenet hadn't succumbed to spam & binary warez. Many of the clients from 20 years ago have more (useful) features than modern forums.

It's probably about time to reinvent it again, tunneled over Websockets with a Flat Responsive html5 Retina-Aware Interhyperface or something.

Any reinvented Usenet should be client agnostic, otherwise it is just going to eventually succumb to the same problems that we already have with web forums.

In which case it will eventually succumb to the problem of RSS - the biggest client will decide to drop it in favor of moving to a proprietary system.

(Well I suppose that is what you get for using a webclient that you are not paying for....)

What is the alternative here though? Instead of making it client agnostic, make it not client agnostic? How does that not make the situation even worse? Being client agnostic means that it doesn't matter if one particular client is discontinued. That is practically the entire point of being client agnostic...

Any solution that will be viable in the long-term needs to be decentralized and client agnostic. Otherwise you are not reinventing Usenet, you are just reinventing web forums poorly.

Edit: Aaaah, I need more sleep.


I was actually just griping.

I've always wanted to see a nested-discussion system with upvotes/downvotes that does the kind of seamless no-F5 updating you see on facebook.

Wouldn't that mean that as you're reading a comment it could suddenly start moving up or down the screen? That'd make it pretty hard to read the stuff tailored for shills/fanboys/antifanboys...oh you may be onto something..

I'm not all that happy with mailing lists. Mail clients generally think of a "thread" as a list, which works OK for a back and forth discussion between two people, or for a discussion among a small group of people that are focused on a narrow problem. For a thread that gets big (in participants or in scope), that tends to suck. A tree is a better representation.

A second problem with mailing lists is that unless you keep old messages, you generally have to go to some horrible web-based archive.

Why not use an NNTP server? Newsreaders are great at handling threads, whether they are simple linear threads like those suited for email, or massive trees with dozens of participants and many side discussions.

Trees is indeed what I mean by "threads". Email naturally does it, though perhaps some clients have poor support for displaying it nicely. The linear "list" view of "threads" is what forums call "threads" and is exactly what I do not like.

Those web-based mailing list archives, while usually unstyled and therefore "ugly", are well-indexed by search engines, easy to navigate, fast, and uncluttered. They are not perfect, but they offer a much better browsing/reading experience than standard web forums.

Going back to NNTP would be idea. I don't know how we actually do that en-masse though.

Gmane has NNTP feeds for all their mail list archives: http://gmane.org/features.php

I honestly don't understand why everybody uses phpBB. The OSS project that I was thinking of when I made this post (zero-k.info, a small FOSS rts) rolled their own for just the reasons you described - it's primitive in some ways but at least it doesn't page.

I like the Discourse approach. http://www.discourse.org/

Instead of nested replies, it encourages "Creating new threads linking back to a post", which I find to be way more orderly than "conversation trees". They're also aiming for feature-parity with mailing lists, allowing people to participate effectively with threads by e-mail alone.

He's not looking for up/down votes. He's looking for a discussion. Which well-meaning participants in an open source project should be able to have with some civility.

You can find discussion greatly facilitated when everyone has the power to silence the imbeciles by down-voting them into oblivion.

I agree that technical solutions help. But they will never be a real solution. The eager troll will find a way around them. The real problem is a lack of strong leadership and stewardship. There is no BDFL setting the tone and punishing those who don't toe the line. Or maybe there is and this is the result. Ha!

For a long time I've thought that rather than absolute up/down votes, collaborative filtering might work better.

I've tried to drum up attention to it before now:


The problem is the mailing list is open to anyone and the majority of people on the list should be providing input.

There are moderated lists. When someone gets out of hand give them a temporary ban, and tell everyone why there were banned. People will learn that if they want to participate they will have to behave. After time, when the community scares away the trolls, they can loosen the moderation rules. There are plenty of communities that self moderate after having a strong leader show them what was socially acceptable and what was not.

It's not necessarily about misbehaving. You can "behave" and yet still derail a discussion or provide no useful input. I'd say there wasn't terrible uncivil about the internals list.

But it's less like a technical discussion list and more like an open forum. The signal to noise ratio is pretty low.

Why not put RFCs in a special issue tracker?

I recently started learning PHP as my first programming language and I love it so far. But the amount of negativity and hatred I see towards PHP on the internet (even among so-called PHP lovers) makes me question my decision of learning PHP.

My main purpose for learning PHP is for web-development. I have looked into java code and I felt like I am going to shit pants if I have to learn that.

2 questions.

- Am I wasting my time with PHP?

- What are some good alternative for web-development that preferably doesn't have a steep learning curve?

I am taking a risk here and going against the popular opinion. Note that this is my opinion, not a hard fact.

If you are learning PHP in 2013, yes, you are wasting your time. PHP's killer feature was (not any more) $5 web hosting, where you could upload your index.php with FTP and you're done with deployment. This is no longer the case. PHP stands for (at least used to) "Php is a Html Preprocessor", but at some point it turned into a general purpose programming language, largely as an afterthought.

Yes, you can learn web programming using PHP and that skill won't be wasted. But a lot of the PHP specific issues you'll be dealing with is just going to be a waste of time. There is a lot of WTF issues in PHP that you'll inevitably stumble into. This will be a major factor in the time wasted.

In addition, the world is full of bad PHP code. Yes, there is good PHP code too but the proportion of bad code is probably larger than in other languages. This will mislead you and make you learn bad practices more than you would perhaps do if you'd be learning another language. These are cultural, not technical issues.

For a beginner, I would recommend Python or JavaScript. Neither of them is my favorite language, but Python is rather beginner friendly and JavaScript has a special role since it's the language that web browsers use. Ruby is popular too, but in my opinion it has more traps a beginner could stumble into (not so much for an experienced programmer).

For learning purposes (not production code), I would perhaps even recommend staying out of big monolithic frameworks like Django and Rails and learn how things work internally. You'll get a better idea from HTTP and other web technologies if you build your own "framework" from building blocks like WSGI, SQL alchemy and a templating engine like Mako or Mustache (these are Python-specific, for another language, you'd pick other tools).

This is my recommendation for a beginner looking into web programming and my motivation is to keep a beginner away from bad technologies that may teach bad practices.

So brave. Trust me, on hackernews you are not going against the popular opinion. Actually you'd be hard pressed to find any decent programmer community in 2013 that advocates PHP for beginners.

Of course there are. There's many. You just gotta get out of the elitest groups.

You definitely aren't wasting your time, but it would be great for you to also learn Python well enough to understand peoples' negativity toward PHP, even (especially?) if you decide you disagree with them.

- nodejs: Write in coffeescript or javascript on the server, two bird with one stone philosophy. Will let you build better programming techniques in respect to structure due to (1) it's async and (2) it's module based. Unlike php the global namespace should not be used. Additionally, JS is just better than PHP in every way I can think of. Node has a thriving user module community. Cons are that you have to deal with async, module dependencies and setting node up on a server (or really anything besides PHP) is far more complex.

- GO: google's lang, seems to be trending lately. Lets you build potentially more elegant, higher performance web apps (if you believe the benchmarks) than node but will have a higher learning curve, less of a userbase.

- Python: Someone else will have to comment on python (and probably GO). Afaik it's a useful language to use overall.

> Unlike php the global namespace should not be used

What do you mean? What's the "global namespace" in PHP and why do you need to use it?

php has the ability to have global keyword in a namespace to use something out of scope.

And it is easy to use it ... and you don't want to maintain code written like that.

Whether or not you stick with PHP, you should learn some other languages. At the very least, it will make you a much better PHP programmer. But maybe you'll find something you like better.

Ruby, Python, and Node are all reasonable next things to try. Large communities, lots of resources, and plenty of example code to look at.

I leave PHP last year. The way PHP moves is not my way anymore. After so many years of using, it get boring too.

PHP has a problem, the "old stuff" / compatibility, like all older projects have. They change things, but slowly and sometimes inconseqent. I hope the will really renew everything with a new version, even if that mean that they lose many users.

In the last years so many new languages and styles were born, you feel really old with PHP ;-) ... that does not mean that the others were better.

You're not a "PHP programmer" unless that's the only thing you know, and if that's the case, you're cheating yourself.

Be a "programmer". Learn other languages. It makes you a better programmer in general.

No, you are not wasting your time. You will read people complain about PHP but in the end, it provides me with a great job that pays the bills and then some! When used properly, it doesn't have to be a bad language and can be fun. That, and if you are just starting to get into web development, it is a great place to start. You can always branch out into other web technologies down the road. Have fun and keep learning :-)

> When used properly, it doesn't have to be a bad language

> That, and if you are just starting to get into web development

These two things don't square well, and is a major reason why I discourage PHP. It's pedagogically suboptimal to be encouraging the sorts of behavior that culturally accepted PHP often does.

You can write good PHP. After many years I got to the point where I could say confidently that I can. But it took me most of a decade to get to that point of confidence.

So what you are saying is that unless you can write good code from day one you shouldn't attempt to use a language, regardless of language?

The code I'd write in say, Clojure day one would be terrible when compared to the code I'd write a year or two later. Does that mean I shouldn't learn and use it?

What bad things are culturally accepted in PHP?

Most common thing that seems to come out is using string concat for sql queries.

Is the last time you even looked at PHP about 6 years ago?

You and yours really need to read up on what you hate so much so you don't look like a bunch of fools arguing about things that don't exist.

That said: There are many projects still using crap like that, but that is because of bad programmers. This stuff is deprecated in core and its use is heavily discouraged.

PHP has always had the option to write good code. It's Turing-complete, you could just write a Haskell interpreter for it if you wanted. The problem has always been that PHP's bad programmers, by and large, are the ones evangelizing the language and writing the tutorials, so anyone trying to "learn programming" via PHP gets heavily exposed to things-only-bad-programmers-do, and never really sees much good code to know that there's another way.

I'm trying to do my part. I'm a mod of /r/php and trim out the crap and promote the good stuff.

Anytime someone new to PHP or not at a higher level asks a question, I point them to proper resources.

I'm in ##php and #phpmentoring on Freenode helping out with questions.

I write articles that are, in my humble opinion, not bad and have received many compliments from people who learned from my writings.

I'm doing my part, and so are many other PHP-centric developers, and it's annoying as hell to have us lumped in with code that's several years old, or sweatshop programmers that know nothing more than the very basics.

Yes, 8 years ago ... PDO and prepared statements is the quasi-standard since the release of PHP 5.1

Please. Stop using sense and UP TO DATE arguments. Everyone who talks negatively about PHP always talks about PHP4... These people are basing their opinions about a language they barely even used a decade ago.. This is annoying.

...if you're lucky to be working in a PHP dev shop that utilises current and proper tech. Most PHP shops that I've had experience with, either directly or through other PHP coders, are mostly stuck with mysql_query esque setups all over the place. If they're lucky, someone wrote an OO wrapper for it.

That being said, it's a small sample size of maybe just over 100 over the last few years. Weigh accordingly.

Learning is never a waste of time, but would that time being better employed with another technology? I think, definitely, yes.

Important point, whether you like php or not, you need to know why. If you like it because you are comfortable with it, make sure to know why. Being comfortable in a dev environment is great when you are learning, but very dangerous in the long run, since learning something new will be much (much) more painful.

Also, what is your final goal ?

If you just want to learn to build websites, regardless of top notch ways of doing things, just stick with what you are productive and comfortable with. The more reputable tech you use, the better, but it's not the point.

If you want to learn websites because it looks like a good way to learn programming in general, don't stay in the comfortable zone, don't fear the steep learning curve, embrace it. Well, it's not masochism either, if it's too painful, just stop. You have been intimidated by Java, but don't let it divert you from all other techs. Django/Python, Ruby on Rails, NodeJS and some others are much more easier to step into, will teach you much more about programming in general.

You are not wasting your time with learning PHP, but it also is not a good foundation - the language is a collection of tools that someone somewhere found useful.

Employment wise it is a safe bet - there is a lot of legacy code for a person to maintain for a few lifetimes and then more.

The hatred towards PHP is explainable - if you use Haskell or Clojure today it is because you chose it. If you use php it is because you were forced to use it. So every little and not so little gotcha in the language (and there are a lot of them) is causing a lot of pain.

I have used python/(tornado/gevent)/flask/ stack with success.

Disclaimer - PHP programming 4 years, python 1

PHP is fantastic, it's definitely the best web platform if you want to actually get things done.

Having said that, learning a language's syntax is not the same as learning programming (or web development). If you are serious about what you are doing, learn OOP theory, design patterns, the internals of the web (TCP/IP, the HTTP protocol, etc.), security, and a bit of cryptography can't hurt.

So you can use PHP while learning all those things, and you will be golden. Ignore all the FUD and hate around it, eg: "php is insecure", "php websites are a mess", "php is for noobs", "php is slow". Using a different language won't fix any of that, learning how to program will.

And if you ever decide to switch to a different language within the same paradigm (procedural / OOP / semi functional, eg: ruby/python/javascript/java), it won't take longer than a few days, because you already know how to program, so you only have to learn the syntax.

If I was starting today, I'd probably go with javascript coupled with node.js and a client-side framework like angular (and possibly ruby+rails), but php+symfony/laravel wouldn't be a bad way to go and should give good job security for the foreseeable.

Most of the criticism you hear isn't very relevant for a beginner who's learning, and most people having those discussions have forgotten what it is like to be a beginner a long time ago.

If you like the "accessibility" of PHP, if you like programming in it, if you like the learning resources you have and you like the forums you've found, then go for it.

In due time you'll discover what the criticism about PHP was all about, form your own opinion and might check out other options (and Java won't be scary any more - just different syntax and a few concepts that you'll appreciate better when you have some experience).

There's always lots of PHP hating going on from language snobs, mostly from people with toy projects in the latest language du jour (was Ruby, then Node, Scala, now Clojure and Go).

Fact is PHP, for all its faults, still runs far more websites than all of those others combined and then some (http://w3techs.com/technologies/overview/programming_languag... - eg PHP 80%, Ruby 0.5%, Python 0.2%)

The "it's popular, hence it's great" argument isn't a good one to use to evangelize though, at least not by itself. Case in point, what operating system is still the most popular by far? Popular doesn't always equate to best.

You're right, but it's a strawman argument as I never said that. "it's incredibly well used, but it has faults" is nearer the mark.

I second node.js as a learning tool, learning the one syntax will let you get a feel for both areas of web development.

depends if you want to do it for a job, and what the local interest is in your choice of language.

I learned PHP in 2003, and haven't regretted it since. There are quite a few PHP jobs here, and I like the culture that this language brings - unlike ASP.NET which is very corporate.

So yeah, use what makes you happy, PHP is a great start into a lot of other languages as it isn't as intense as others.

use what you love. don't listen to what anyone else says.

- Don't even think that you are wasting your time ! - Ruby/Rails , Python/Django , Node.js

No, you're not wasting your time.

YES, you are wasting your time with PHP! (If by "wasting time" you mean that there are other better ways to use your time and learn much more in the same amount of time.)

PHP is mostly ok as tool to get shit done with but it is one of the worst possible options for something to learn as a first programming language for many reasons, including:

- you will not learn how most real programming languages are, as PHP was not designed or engineered as a programming language, instead it is a collection of tools and commands that mutated and evolved into a programming language

- most code you will encounter written in PHP is very bad code (not all, but most), so you will find it very hard to learn from other people's code (this is the main reason to stay away from PHP imho!)

- it either lacks or has weird variants of the constructs that permit certain very useful styles of programming: no real closures until 5.3 and the need for the `use (...)` syntax to have them behave like in other languages, it has two namespaces for functions and variables (not other common language has this - yeah, there's Perl and Common Lisp, but...), weird stuff when it comes to namespaces, weird rules and stuff like autoloading, more weird stuff around the OOP features...

- so it leads to you learning all sorts of details that are basically untransferable skills - i.e. they won't make you a better programmer in general they will just make you a more effective PHP coder

I seriously recommend you to learn Javascript as a first language, as it has all the important constructs needed to learn programming in a sane way and it will also help you on the front-end side. It's just as simple as PHP to learn (I'd say simpler, because it doesn't have all the weird stuff in PHP) and later it will allow you to learn the basic concepts of both OOP and functional programming without much pain. Whereas coming from PHP, lots of concepts will be difficult to learn because "your mind will be twisted the wrong way". Javascript just feels natural for a beginner with no preconceptions: you can just assign a function to a variable and pass it around as a variable to other functions, then slowly learn what objects are by using them as "arrays" at first, then as arrays that have a special "prototype" (and with this, boom, you will have learned the simplest way to implement what in OOP is fancily called "inheritance" and you are in OOP land now).

Python is cool too, and it might be easier to find webhosts with python support than with Node (this is for Javascript running on the server, like PHP). Ruby too, but it too has "weird stuff" in it so I wouldn't recommend it as a first language, but it's still a better option than PHP. You can easily learn PHP in the future if your job will require, but don't start with it.

> [Javascript] is just as simple as PHP to learn. (I'd say simpler, because it doesn't have all the weird stuff in PHP)

Oh, don't worry; JavaScript has plenty of weird stuff of its own.

With that said, I agree it's probably more worthwhile to learn than PHP.

> it has two namespaces for functions and variables (not other common language has this - yeah, there's Perl and Common Lisp, but...)

Separate namespaces for variables and functions in Perl? Huh?


I figured that may have been the reasoning, but I long ago stopped thinking of the variable names in Perl as just the alphanumeric portion. To me, the native data types, which are denoted by the sigils, are intrinsic to the name.

Yes, that was the reasoning of what I said. It doesn't really change the way you think about the program, but in PHP it leads to stuff like variable variables (`$$myvarname`) and to assigning a string "foo" to `$x` and having `$x(...)` execute as `foo(...)` and so on... which is cool and useful sometimes, but this really messes up a beginner's mind or it leads to code that is almost impossible for beginners to read, comprehend and learn from.

Perl at least had the "if it's different, it should look different" philosophy as a justification for its sigils. PHP just makes functions and variables look different and it feels like CLs two namespace system with `foo(...)` / `(foo ...)` and `$foo` / `(funcall foo ...)` being different, but it was mostly useless in CL too and it has the same side effect of adding extra cognitive overhead to passing functions around, which imho should be as simple and natural for a beginner as possible to ensure that later on he has a safe landing in functional programming land...

Some people pour way too much emotions into the choice of programming languages. PHP is fine and no matter which language you start out with, switching to a new one later isn't a big deal - They are pretty much the same underneath the syntactic layer anyway.

Wow, I strongly disagree with that.

Different languages have different libraries, different communities, different philosophies, different purposes. Sure, a person who started in C can go and write C-ish code in many other languages. But that's bad code. Good code is idiomatic and takes advantage of the strengths of the language and platform it's written for.

Depends on your perspective, I guess. The difference between not knowing how to program and learning, say, ruby is a fair bit larger than the difference between knowing how to program in php and learning ruby.

Take php and ruby (two languages I happen to have used a fair bit both). If you're writing your typical web app, you'd probably use mysql for a database. That's the same. You talk http to the client - same. You want to parse xml? Probably going to use libxml underneath the covers. And so on. So yes, there's different libraries for the two, but there's also a lot that is shared.

As for different philosophies, they are both pretty much imperative languages. Php has a simpler object model than ruby and ruby has some fp features, such as co-routines, but by and large you write programs in the same style.

And different purposes? I'll dispute that. You pretty much use both languages for more or less the same things.

Mind you - I'm not saying they are exactly the same. Clearly they're not. But I'm saying the difference is in the nuances.

And while I do agree that ruby is a nicer language than php, I think the trend of treating it as if it was toxic is completely out of proportions.

I agree that different languages don't all have perfectly different purposes or philosophies, but I'm not sure why you'd think I'm claiming that.

I think you could pick better examples. PHP and Ruby are both interpreted, Perl-inspired languages started by hobbyist first-time language designers who released 1.0 versions about months apart. So yes, if you apply them to similar problems and use similar techniques in the same languages, you'll have similar experiences.

But even so, I think PHP's purpose, which is rooted in letting amateurs simply render web pages, is very different than Ruby's purpose, which is a flexible, general purpose, objects-first scripting language. I also think their design philosophies are pretty different. PHP has never worried much about elegance or consistency; Ruby inherited Perl's DWIM approach, but tried to do it in a way that was not just functional, but beautiful.

You have me a bit confused. You say that I could have picked better examples, but then pretty much agree with me wholesale. So it seems I picked exactly the right example, at least if my intention was to support my own point.

That point being that languages such as Perl, Php, Ruby and even Python is relatively minor. I'll claim that any programmer who is competent with one of these will easily be able to transition to one of the others. There may be reasons why people don't always do this, but I don't think they are intellectual.

Yes, I agree that your intention is apparently to support your own point. In trying to win the argument game, you're missing out on the deeper point, and an opportunity for professional development.

I've learned quite a bit from working in different languages. You may not have, but that doesn't indicate there's nothing to learn.

PHP internals are actually very different from Javascript internals, but the same could be said for a lot of languages. Point stands though, no language is the same as another and habits die hard.

There is pretty much new independent PHP engines nowadays, one of my favorite is an embedded PHP5 implementation named PH7 written in ANSI C and following the SQLite3 coding style (very impressive) http://ph7.symisc.net

PHP is addictive.

You can create whole web app in one PHP file from scratch and it will have everything including API and DB management layer and be secure and fully functioning.

And it will work on all servers and on all operating systems.

Millions are made by average developers developing themes and plugins for wordpress.

Hard to beat all that.

#drama is for queens :)

> You can create whole web app in one PHP file from scratch and it will have everything including API and DB management layer and be secure and fully functioning.

You can. But I shudder to imagine one file containing everything you just said. Also, I'm skeptical about the security claim. I'm not talking about PHP-specific vulnerabilities here. Rather, the developer of such an app might be pretty naive, and might build in his own vulnerabilities.

> And it will work on all servers and on all operating systems.

The same is true of most mainstream languages. Ruby, Python, Java, and Node are probably the big competitors in the web dev space. All of them can run on Windows.

You can. But I shudder to imagine one file containing everything you just said.

Look on my works ye mighty and despair (i know I have): https://gist.github.com/kennethrapp/0ebbd15b509d8f18b095

As someone who's had to deploy PHP apps to various servers on various operating systems, I can guarantee you that your third line is absolutely not the case. You can deploy much code to many servers on some operating systems, but it's far from universal.

It's only universally deployable if the developers knew what they were doing.

The same can be said of any language, it just happens that PHP makes it a bit easier than the others.

The problem is that cheap hosts will often not support newer best practice libraries like PDO. So apps that are widely deployable tend to end up as a jungle of mysql_query().

Is this really still the case?

Granted, it's been a while since I went shopping for hosts, but I thought these days more and more hosts (even cheap ones) at least support 5.3+ if not 5.4. PHP got a huge swath of improvements in these releases so I'd imagine these were more well supported. I mean we're in the middle of 2013 for crying out loud.

I also see more and more cheap VPSes popping up and these may be a more attractive alternative (for novice admins/developers, I think these are still a bit too intimidating).

The biggest hurdle is still the lack of quality tutorials that use PDO for complex projects. You still see a whole bunch of older examples out there that still use mysql_query() and the like and not many that do "A-Z of Building a blog with PDO" or similar.

The power of quality free tutorials shouldn't be underestimated.

It varies, but it's often server configuration as much as language version. You'll still find servers with magic_quotes enabled and a bunch of features disabled.

VPS is a better alternative, but at that point it's just as easy to use something other than PHP.

Ouch. So it's still the wild west out there.

I hope there will come a time for some standardization for web hosts where minimum versions for software packages and sane defaults are enforced. I agree, anyone deploying on VPS really don't have shared host bounds any more.

>You can create whole web app in one PHP file from scratch and it will have everything including API and DB management layer and be secure and fully functioning.

And it's very, very difficult to do that properly, because PHP seems to go out of its way to make all of those things (APIs, DB management, security, functioning) difficult.

>And it will work on all servers and on all operating systems.

Except for UNIX, where function X does Y instead of Z, which it does on Windows. Usually, except in PHP 5.5 and above.

WARNING! If php.ini variable A is set to B, then the above does not apply and instead behaviour C takes effect.

PHP's PDO is extremely easy to work with. Seriously, it's like 5 lines of code to connect to a database and retrieve information. Is that really all that difficult?

Security? DB-wise, use PDO and named parameters. It's passing in an array. Sessions? For private servers, using file-based is fine. For shared or for scaling, use DB/memcache.

APIs? It's dead easy to implement a RESTful interface. Interacting with remote APIs is nothing more than some curl commands, or your tool of choice.

Explain to me what's so difficult here?

Having a language behave slightly differently between different operating systems is ... expected? Maybe? I'm not sure, I never use PHP on Windows. Why would I?

Common Lisp is addictive.

You can create a whole web app in one CL file from scratch and it will have everything including API and DB management layer and be secure and fully functioning.

And it will work on all servers and on all operating systems.

Also hard to beat that.

Just need to find a CL developer for hire...

> fully functional


CL people are not very tolerant of functional nazis. (Probably because functional nazis are usually static type system junkies who scoff at macros and incomplete-impure-but-working solutions to problems which are often associated with CL.)

Indeed. I've found PHP simply allows me to get things done and consequentially it put a lot of food on my table.

There are only two kinds of languages: the ones people complain about and the ones nobody uses - Bjarne Stroustrup

> You can create whole web app in one PHP file from scratch and it will have everything including API and DB management layer and be secure and fully functioning.

> Millions are made by average developers developing themes and plugins for wordpress.

Yep, and thanks to people actually believing in that, php is also keeping the security industry alive and well.

I've been clean for four years now

About 2 years for me. Keeping strong.

I think the only hope PHP has of continuing development is if someone big like Facebook can add some direction to it. Maybe they will but I think last I checked even they were giving up on using it for much more then a thin veneer to their back end services.

Even if a large company like Facebook did want to help add direction, they'd have to do so within the confines of internals and the RFC process.

The prehistoric luddites and trolls on the list would shout down any truly language-improving proposals in the same way they always do, regardless of source.

The only way to get rid of those unwanted elements would be a fork, but that would be unproductive. The remaining thing keeping PHP so popular is how amazingly ubiquitous it is. A fork wouldn't have that advantage, especially in comparison to languages and environments that are objectively better anyway.

> The remaining thing keeping PHP so popular is how amazingly ubiquitous it is. A fork wouldn't have that advantage, especially in comparison to languages and environments that are objectively better anyway.

Initially, I believe you are correct, but I am not sure long term. PHP is easy for a system admin to install. Other than perl, I am not sure if there is anything out there that is as easy. I would imagine a fork, if it wants to survive, would need to be just as easy.

I do wonder why PHP has never really had any competition in the "super easy for my system admin" category.

It's not just ease of installation by sysadmins, but ease of use on shared hosting and ease of script installation by non-developers.

I can walk my mother through installation of a PHP script. I can almost walk her through installation of a CGI script in any language, really. But unless that shared host has already set up a Python or Ruby environment (few do; I can count the ones I know on my left hand), I'd never, ever dream of trying to walk her through setting up something in other languages.

Making running scripts as easy as dropping them onto a filesystem would be perhaps the killer feature for other languages to target, if they want to take a bite out of PHP's consumer market share.

Of course, then there's another battle: shared hosting providers. The vast majority are running some sort of third-party control panel software with very opinionated hooks deep into every bit of configuration on the machine. Unless that killer feature can be baked into that software, and unless the shared host actually updates their software, there's no hope.

You wouldn't believe how many shared hosts are running ten+ year old installations of everything, not giving a crap that they're out of date. And hey, that ten year old version of PHP still installed there is still going to work just fine with the majority of scripts...

A lot of things are becoming extremely easy to install though. With the growth of AWS and cloud-services I'd guess there will be movement away over the next 5 years.

I have not seen anything that comes close (other than CGI scripts) from either the system admin side or the client code side. I would love to know if other folks are addressing this. The closest (well, other than Perl) is some of the tooling surrounding Java deployment.

Indeed, Facebook is already using their own fork of PHP.

I read the entire sub-tree under this comment and still cannot figure out what exactly Facebook is written in. Is this because nobody at Facebook actually knows what the entire stack looks like or because they keep it a secret?

With their "Move fast, break things" motto I can only shudder at the imagination of the scenarios happening at Facebook HQ:

"Hey, so you are the new developer in town? Can you build service X which service Y and Z can use? Just write a proper API, we need this ASAP."

- "So what do I write this service in? Any framework already build to support these operations?"

"Pick your poison! Check our internal repository collection and see if you can re-use anything useful. As long as we can communicate with it via the API!"

Facebook isn't built with PHP (using hiphop-php) anymore?

Hip Hop is giving up on PHP internals while not having to throw out legacy code [immediately anyway]. They might for all I know still use plain PHP for some things but the Hip Hop project is not a vote of confidence.

The PHP code is the tip of the iceberg. The real work in Facebook is done by the many systems behind it, which are very definitely not written in PHP.

Facebook is entirely written in PHP. It uses all sorts of databases and other systems to handle stuff, but so does every other website. It's still written in PHP.

Facebook has their own PHP fork, which they use/and modify. I do not believe that Facebook pushes their modifications to PHP as a whole.

Those "databases and other systems" make up a significant portion of their code base, and in many cases Facebook either contributes to their development or created them internally. To claim that Facebook is written entirely in PHP is false. Examples:

- Cassandra (Java) was created by Facebook http://en.wikipedia.org/wiki/Apache_Cassandra

- Giraph (Java) has significant contributions from Facebook and I believe was founded there http://giraph.apache.org/

- FP (Erlang IIRC) at Facebook http://cufp.org/videos/functional-programming-facebook

- Facebook's page listing some of the open source projects they contribute to https://developers.facebook.com/opensource/

The last link you posted has this though; "PHP is an incredibly popular scripting language which makes up the majority of our code-base. Its simple syntax lets us move fast and iterate on products." Not sure if I believe it though.

Alright, let me correct myself then. The "frontend" of Facebook is written entirely in PHP.

The backend is written in everything from Erlang to C++.

Don't correct yourself. The majority of the backend is written in PHP as well.

AFAIK it's not true. First they don't use raw php: https://github.com/facebook/xhp/wiki

Then they use it only for the view layer, it only pull some data from memcache to render HTML.

But all the hard work is C++ / Java / Tornado / etc

Correct me if I am wrong, but very few large scale project (if any at all) use raw PHP. Most of them rely on some kind of framework. Besides FB said it themselves that large portion of their code is PHP.

Well, that would presumably mean that the bulk of their code is view code. Which, by line count, probably makes sense.

The front end is PHP, but I thought they used other languages (such as Scala, Erlang, and C++).

I found a page from 2010, but I couldn't find a more up-to-date source.


I think what's important here is that PHP developers shouldn't look past the curtain. The whole web stack is a house of cards. The state of PHP doesn't change that. ;)

PHP is powering a huge industry. A lot of money is flowing on PHP code, from PHP developers banging out code for paying clients to companies like Facebook which got started as PHP apps. Wordpress powers a ridiculous number of companies which run on its code.

PHP may be a mess, but lets keep things in perspective. The state of what really matters is alive and well.

HN white knights JavaScript but hates PHP. I can't figure it out. Each language is horrible in similar ways.

The similar horrible things are the superficial warts related to dynamic typing and heavy usage by amateurs leading to poor code quality in the wild. However there's a big difference which is that Javascript has always had first-class functions, lexical scope, and object-oriented via prototypal inheritance. PHP attempted to bolt on some approximation of all of these over the years, but the result is a sort of Frankenstein shambler.

Javascript for all its problems at least was designed with a reasonably powerful core. That said, HN has plenty of terrible things to say about JS, so I think you're exaggerating a bit.

Not really. JS has some design flaws, but if you look past them it is a really solid language. On the other hand, PHP started with design flaws, then accumulated different design flaws from all paradigms, so it is now a frankenstein of design flaws.

I've used both. Each of these languages has its quirks. But JS's design makes PHP's design look like it was done with crayons.

I will never forgive JS for the `this` pointer.

I will never forgive PHP for all kinds of shit.

Care to expand on that a bit (without repeating items found in the "Fractal of Bad Design" article)?

Writing in PHP is a war against the platform - that's why PHP code tends to look like a battlefield...

That's why i'm impressed with Symfony and Doctrine.

Taking one of the worst language out there , and creating these well crafter libraries , that's insane. I think type hinting and basic POO saved PHP.

Symfony..maybe..but Doctrine?

Do we really need a sudo-sql language for creating object->db table relational mappings?

I used Doctrine extensively at my last job..and I will not be using it for any personal projects. It's bloated and when I need to optimize a sql query, I have to essentially create a hack outside of the main ORM..which kinda defeats the purpose in the first place.

I much prefer Zend or Codeigniter.

Doctrine1 was a mess. It was riddled with magic functions that were horrible to work with. It was slow, too.

Doctrine2, mixed with entities, is awesome. Its relationship manager is fun and easy to work with and it works very well.

You can even create hand-written custom queries if you want, using its own DSL that's fairly similar to what you would expect.

Use the Query builder, you dont need to use DQL.

He complains about how internals lacks leadership, so why doesn't step up and fill that void instead of running away?

He tried that. He also cites an example :

  "To illustrate why this is an issue, I posted this reply explicitly asking 
  for feedback on two items. How many replies did I get? One. A single reply. 
  Oh, there were more replies to the thread afterwards. But they were too 
  busy arguing over the other off-topic or non-constructive things in the 
  above list to actually discuss the open issues with the proposal."

The problem here seems to be quite endemic and I don't think there are any simple fixes. This seems to be a cultural problem. I'm not even sure how to tackle something like that.

Because you can't take a toxic community and suddenly say 'Okay, I'm in charge!' without everyone else tearing you down. And perhaps he has other things to do with his time than babysit a bunch of (apparently) arrogant, condescending grown children.

Beyond the fact that the PHP community doesn't really do the BDFL thing, the process for adopting changes to the language is designed to be run by group consensus, not by the older model of having a small group of self-appointed leaders.

I suppose a core problem is that before the current process, a very large number of the people causing trouble happened to also be the self-appointed leaders.

It is not possible to change people, that dont want to be changed.

As long as they not see, that there is something wrong, they will be against any change.

This is absolutely normal, this ist humanly.

He did the only right thing, he change himself and leave them. He want a change.

PHP will be useful if the bloat is eliminated. Just plain procedural scripting, simple, straight - Nothing else is needed. By the way, that is my view of any scripting language. Languages used to write complex systems should be type safe and strictly structured.

Is this just a case of meritocracy at play?

I haven't followed the full discussion and events leading up to here, but would it be very wrong to assume this just a case of a bystander starting a discussion that didn't really catch on with any of the active maintainers?

> would it be very wrong to assume this just a case of a bystander starting a discussion that didn't really catch on with any of the active maintainers?

Anthony (ircmaxell) contributed some patches to the past few major releases (including the new password API and PBKDF functions) and is well-respected by a large number of PHP developers.

He's also proposed nearly a dozen RFCs including working patches, most of which include incremental but major feature improvements. He and some of the others are trying to improve PHP as a language.

The problem is that there are a handful of people that do not want language changes, think that some changes are confusing for developers, and are generally not actually able to understand the use case behind things, like, oh, I dunno, named parameters. So instead of having a well-reasoned discussion, they basically shout the proposal down.

Thankfully the RFC and voting process can bypass the volume of their arguments, but not always.

I've read about the toxicity of php-internals so many times, without any opposing views, that i'm quite willing to believe it. However, I'm not convinced other projects that aren't run by a benevolent dictator fare any better. This is just how projects get when everyone on the internet can throw their 2 cents into the game.

No. This is a big guy in internals. Sad to see him step back like this, but totally understandable.

Internals suffers from simply having too many voices. As with all things you need a leader that is reasonable and can push things in the right direction.

For example, I don't think I've seen a constructive discussion on having some kind of object literal in the language to replace something like

    $obj = (object)['prop' => 'val', ...];

Given the responses cited at the end of the post, I would assume that the author was previously a contributor of some significance to the project.

I just grepped the php-5.4.19 source and the only mention I found was for a bug reported and fixed in some earlier version, though.

Doing a `git shortlog --author "Anthony Ferrara"` in php-src/master pulls up 72 separate commits.

Slightly off topic, but relevant question: how many people move away from PHP because they get too annoyed to work with it - even if it does "work" - and how many are moving from other languages _to_ PHP because they had enough of another language.

Move to Python, I'm sure the community can benefit from your skills. I see no future in PHP development. If the core is rotten ,you can have the best libs in the world (symfony,doctrine,...) in the end you still need to face PHP architectural problems. Or back to the JVM maybe.

Am I the only one who feels like this is a temper-tantrum of somebody who wanted to be in charge of more toys, punctuated with some salient (but obvious) points about PHP?

ircmaxwell has contributed a hell of a lot to PHP recently, this is not some worthless shmuck complaining, this is someone that can and does provide significant value to the community.

Who said he was a "worthless schmuck"?

Geniuses can have temper-tantrums, too. Just because he has made worthy contributions doesn't mean that he isn't acting like a drama queen.

You referred to his post as a temper tantrum (subtext: he's being childish), refer to him as someone who just wants more "toys" (subtext: also childish), and just had to point out that his points about PHP were obvious (subtext: nothing interesting to say). Then you suggested that he might be a drama queen (subtext: too numerous to list here). That may not reflect your feelings, but that is what you communicated, whether you meant to or not. It's the nature of electronic communication- it's very easy to misinterpret. Maybe you talk like this in real life and being somewhat hyperbolic in your choice of words is a humorous verbal quirk, but none of that comes across electronically.

Who said he was a "worthless schmuck"?

You've implied that what he's in charge of right now are "toys". Does that qualify?

That was ad hominem. Try addressing the individual issues he raised.

Yes, you're the only one.

I think you answered your own question there.

Registration is open for Startup School 2019. Classes start July 22nd.

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