15 ms·
Why PHP won
- jimbokun 18y ago"The platforms that win on the web are those that mirror its fundamental structure, not those that try to morph it into a more traditional "elegant" shape." This reminds me of why C succeeded, because it mirrors Unix so well, that C and Unix succeeded hand in hand. So this part about PHP mirroring the shape of the web made the most sense to me, as someone who doesn't know any PHP.
- 1gor 18y ago>C succeeded, because it mirrors Unix so well Actually, Unix succeeded after it was rewritten in C. (Not counting the very first Unix version which was done in assembler. See http://www.livinginternet.com/i/iw_unix_c.htm http://www.livinginternet.com/i/iw_unix_c.htm )
- scott_s 18y agojimbokun's point was that C and Unix succeeded as a pair, which I agree with. C allowed Unix to be a portable OS, and the proliferation of Unix meant that everyone who did systems work learned C.
- mdasen 18y agoGood article. To add a few things: 1. PHP doesn't require routing. It's done for you by Apache to the PHP file at that location. Sure, you can go the way of nice frameworks like Cake and add routing for nicer URLs, but it's not required. PHP has some solution built in. 2. Deployment. The author touched on having to restart when using mod_perl, but it's more than that. In most cases, uploading files is enough. That's why it became so popular with shared hosts. Anyone with a little knowledge could do it without the host having to give them permissions to do stuff. 3. PHP was very big on re-use in the large. Basically, re-use in the large means creating a calendar app. Re-use in the small is more like creating a framework that makes it easier to create a calendar app (ala Rails/Django). So, when you're starting up, it makes it easy to show friends something really working fast. And that builds mindshare that continues on as programmers do more things. 4. Loose typing. This is probably one of the huge ones. Many languages are dynamically typed, but if you're developing in Python or Ruby, you have to cast between types. PHP says, "don't worry, I know what you mean!" I'm personally not a fan of loose typing, but I can understand why it helps PHP gain followers (esp those new at programming). However, I kinda disagree with the author's thesis. The author argues that PHP's community backs the language so well. I'm less inclined to agree with that. During the day, I'm often working on PHP stuff and I'm constantly finding the code already written to be sub-par. Part of that is that PHP is accessible enough for those who don't understand program design to convince themselves that they're a good programmer. And so many things written in PHP might be from people who wouldn't be able to answer "what's the difference between a binary search tree and a linked list and give an example when you would use each." Not that data structures are the only thing to judge a programmer by, but you get a lot of people in the PHP world that use the guess and check method. So, the community isn't worth as much to me because I don't have such faith in their code (while I find the Python modules I look at to be of good quality). PHP will continue to be a dominant web language because it's easy to pick up. However, I guess I'm looking for something else.
- rbanffy 18y agoItem 2 should not really be a problem unless you are using cheap shared hosting. You should test your stuff on your workstation, not on the server. If you do not test on the server, the whole restart apache after you upload something becomes moot. Also, if you happen to change many files, what will users see in your application when half of the site uses new logic and half of it used the previous one? This is a nasty habit. Loose typing is the cause of many, many very difficult to find bugs. Nobody should ever be exposed to that. As for the code already written being sub-par, it comes with the low entry barrier. The easier it is, the more people who shouldn't program will program in it.
- rockbilly 18y agoI think the point is that PHP grabs people when they're on cheap shared hosting and they continue using it as they build more complicated stuff.
- lnguyen 18y agoAnd it's only recently with the rise of virtualization that we have any options besides cheap shared hosting and horrifically expensive dedicated server/colo.
- KrisJordan 18y agoAgree with your additions completely and would amend your #3 to say that PHP was big on re-use in the small, as well. I've known folks starting out with PHP who cobble a script together by copy-pasting snippets of code from here and there. Inelegant, yes, but when you are working on a small project it was usually effective. This leads me to one point about PHP's documentation that I was surprised not to see. Their documentation has always (as long as I can remember, at least) had public comments. On many occasions questions I have had or example code I needed was crowdsourced by the public and located in-line below the function reference. I have been surprised other platforms don't make more extensive use of this. Finally, in response to your "I guess I'm looking for something else." Understand your discontent - I've felt it myself over the past couple years and have found myself toying with Djagno, et. al. This fall I found myself returning to PHP with a mission to create a framework that I could use and not feel shamed to be in PHP. It's still early in development (4 months) but I believe it is looking good and getting exciting. It's called Recess, check it out sometime: http://www.recessframework.org/ http://www.recessframework.org/
- brlewis 18y agoThis article is totally barking up the wrong tree. PHP's growth had little to do with its appeal to programmers, and lots to do with its appeal to shared hosting providers. Safe mode is what I'm talking about.
- neilk 18y agoI wish I could upmod you more points. That's 50% of the reason right there. mod_perl was a far superior solution, and you didn't have to restart Apache every time. However, this was not the default configuration, which is apparently enough to deter decently smart people.
- icode 18y agoI have been a coder all my life and PHP very much appeals to me. I used Assembler, Basic, Pascal, C++ and a couple of other languages and now that I code in PHP, its the best part of my life. It enabled me to write multiple hugely successful websites that make me enough money for me, so I can do whatever I want. For the rest of my life. I really love Linux, Apache and MySql. So doing things in LAMP is just great for me. Hosting is a big part of my business, so yeah - its cool that PHP is all around. You can get new servers for no money in seconds. Its a wonderful world. Im so happy, there is LAMP. I never used Perl, Ruby, Lisp or Arc. So I cannot say anything about these. I can only say I dont miss a thing with LAMP. I have a LOT of complaints about HTML and Javascript. I hated using Microsoft stuff. LAMP was the breaktrhough.
- Fuca 18y agoAny tips or a blog where you share your ideas for the ones who want to follow your steps?
- icode 18y agoIm not that good with words. That outburst of delight I wrote above is probably one of the better posts I wrote. Who knows, maybe Im getting better at this. Then I might start a blog one day.
- smoody 18y agoAlso, PHP runs everywhere. right now. Nothing to install in most cases. That's one of the reasons it is winning the open source code base wars (SugarCRM, Wordpress, Drupal, etc. etc.).
- ars 18y agoYou know, after seeing over and over how the supposedly worse ways actually worked better - perhaps it's time to re-decide what is actually good and bad in a language?
- stcredzero 18y agoThe ecosystem a piece of software is attached to is tremendously important. PHP did a great job with fitting into the existing one. It's not that PHP is better. It did a better job in the most critical ways. (It was also decently fast.)
- tdonia 18y agothe argument against this is usually performance and code maintenance. writing something in a strict but clearly articulated language means there's a better chance the next person looking at the code will be able to figure it out. that said, php in many ways better reflects the opportunists in us all and is more familiar because of it. by using a hodgepodge of conventions all abstracted away from their parent languages into the same compiler, php lets us pick from a much wider palette of metaphors when we're conceptualizing how we approach solving a problem. which can be pretty damn useful for those of us who don't know all the answers. it feels as though it's designed for us (messy) humans.
- kuniklo 18y agoIt's the old worse is better thing all over again: http://www.jwz.org/doc/worse-is-better.html http://www.jwz.org/doc/worse-is-better.html Maybe all the "better" languages are a case of misdirected optimization, where the critical resource is developer time?
- dasil003 18y agoIt just depends where you are in terms of experience. It's not that one is good or bad. PHP is easy to understand, and you can jump right into it with no experience. However over time if you have any potential as a serious programmer you will find the pain points and repetitive tasks. In many ways, experienced programmers and language elitists are a lot like corporations. They are risk-averse. The reason best practices are what they are is to avoid known problems (sort of like bureaucracy). This will make you a better programmer to a certain point, but it's also so easy to overestimate risk. The painful truth is that a 20-year-old hacker figuring out things as he goes may be able to plow through the naive problems he inevitably creates and arrive at a finished, valuable product faster than a seasoned developer who writes uber-maintainable code with a comprehensive test suite and every best practice he can lay his hands on.
- geuis 18y agoPHP is the language that got me to where I am now. In the last 2 months, I've started diving into server-side javascript and have been working with a couple of small projects that are working to bring out widely usable solution. Its really only been in the last year that I've started sniffing when I have to work in PHP. Its been my bread and butter for 4 years, but I've gotten to the point where the inconsistencies in the overall naming schema are annoying (is it "(x,y) or (y,x)" for this string method?). Deployment is super easy with PHP. I think one thing the author missed is that Java is (unfortunately) the primary language taught to most beginning programmers in college. This fundamentally shapes their budding programmer mentalities. PHP has served a similar role as a way for a lot of people like me to get into programming that didn't do much college and are completely self-taught.
- voidpointer 18y agoMost importantly, back in the day 1998/1999 there was not much around that could match up to the functionality of PHP. Java servlets were not supported widely, Netscape had their serverside javascript wich required you to buy into their servers... Going with PHP was a no-brainer for any small web-shop/startup. With all the web stacks that are available today, it wouldn't have been that clear.
- deleted 18y ago[deleted]
- senthil_rajasek 18y agoAlso, don't forget the nice support for php (using fastcgi) on iis 7/6 http://www.iis.net/php http://www.iis.net/php
- martythemaniak 18y agoTo summarize it, I would say PHP is the "get shit done" language. It allows people who are just starting out with programming or people who aren't very technical to focus on what they need to have, rather than on the best way to do something. This is why so many websites (Flickr) and OS pieces of software are in PHP - they focused heavily on what users would be seeing, rather than what developers would be seeing and won out. Of course, PHP doesn't preclude good design either. Once you have a working product that is excellent on the outside but ugly on the inside, you can start spending more time refactoring your code, or even slowly migrating your system piece-by-piece to another platform.
- pj 18y agoThe question remains, "What did PHP win?" I don't mean to be a jerk here, but just saying why something is good doesn't mean it wins. Lots of languages are good and I could list lots of good things about lots of languages that would make <i>them</i> win.
- jpcx01 18y agoI didn't realize that the game was over, and PHP won. Guess I should pack up and go home.
- pj 18y agodid you realize that no one can be a hacker if they don't think PHP is so l33t that ur just not cool if you don't get it! what do you mean have i ever used java? what does that matter, PHP is awesome, so java sucks.
- gamble 18y agoI'd love to refute this article, because it's incredibly depressing to suspect that it's on the money. There's not much hope for software engineering if the features that make for a poor language are also the ones that make it popular.
- cedsav 18y agoIt's popular because it's a great platform, not because of its poor language design.
- inerte 18y agoThere's no much hope in engineering at all if you don't give what its users are looking for. While I am on it, not one of the article's points is about the language design or syntax. Maybe the fourth, about OOP, but it says something else: It's not really about OOP, but making what users want to do (grab form data, insert into db) incredible easy. The author makes the mistake to confuse OOP with bloatness, which is wrong in theory but right in practice. A lot of people that make web apps in Java make it utterly complex. My point is that Python, Perl, Java, or any other language can do points 1, 2, 3 and 4. But they didn't (not blaming anyone here, just saying that it wasn't done), so you can have a nice engineered language, but they need to provide these four things to be more sucessful on the web. One thing doesn't exclude the other... but someone needs to do it :)
- kingkongrevenge 18y agoPHP won because mod_php was well done. The language isn't especially relevant. Perl's mod_perl was simply a no go for the typical hosting scenario because it gives way too much power to users to screw up the server; you can't realistically set it up for basic shared hosting. mod_perlite is a new piece of software that brings a php style system to perl. It's mod_perl made suitable for typical hosting needs.
- moder 18y agoInteresting. http://www.modperlite.org/ http://www.modperlite.org/ The interview by chromatic was quite informative. Unfortunately, they say that they're forced to repeatedly reinitialize the perl interpreter with every request. This would seem to defeat the purpose of having a persistent perl, no?
- gregp 18y agoWithout getting off topic about what a good programmer is etc - One thing to point out that is relevant is the fact that there are a lot more beginner programmers than non-beginner programmers out there - all the content being generated around forums for performing specific tasks (code snippets and QA) created an insane feedback loop for the PHP community - I think that this is where PHP really beats out everyone else - There is much more google searchable support than any other language out there. Fast ROI of your time/instant gratification which fuels beginners to learn more/ask more questions generating more content and answering more questions.
- wooby 18y agoIn the late 90s, when I began making webpages, there was a mysterious folder in my shared hosting FTP account called "cgi-bin." What is "Bin." I was on Windows. What is "CGI." A friend told me it had something to do with Perl. I didn't know anything about Perl, and everything I found on the web about it was difficult to understand. After some experimenting with FrontPage extensions, I began to experiment more. I found a site called Matt's script archive that had Perl CGIs that I could actually understand. It was slow, slow going. I was coming from QBasic. I scoured the Web, mixing and matching bits of example code I'd found to make things like random quotation generators. Then a friend showed me something called PHP. PHP, to me at the time, wasn't just a language - it was an ecosystem of developers, example code, and practices that was flourishing. There was consolidated documentation. There were global functions for any string operation I could conceive. But most importantly to me at the time, there was an active community who was interested in more than showing off their most arcane, clever, and obfuscated programs. Very early on, the PHP community could be characterized as "welcoming." I would argue that PHP "won" not because of any innate technical superiority over any of the other languages available for web programming in the mid to late 90s. It won because it had the right kind of community for a new breed of developer - the "web programmer." It didn't have the stigma of snootiness that came with trying to figure out Perl. PHP was not for geniuses or academics; PHP was for people who wanted to make dynamic websites and not have to catch attitude from some asshole in IRC about not knowing what tail recursion is. I don't use PHP anymore. I don't like PHP any more. I got into Java, JavaScript, C, even Prolog; and now, I'm into whatever will save me time, and scale. Language agnostic. I'm into parallelization and web services; why would I use PHP for anything more than toy projects? Yes - PHP is "easy." But at my current (thankfully temporary) job, I'm in charge of adding features and debugging a massive functionally-written PHP codebase. It is horrifying. I think PHP is a great language for anyone to learn how to program with. I think there's a lot of shitty PHP code out there and it's easy to make a living by billing yourself as a PHP developer. It introduced me to "C-like" syntax of brackets and semicolons. It's an easy way to learn how to do neat things with SQL. Beyond that, it really just sucks, and no matter how much more crap they add on to it, I think it always will. So what is the lesson here? PHP won because it had an excellent community. The Ruby/Rails uprising of the past few years reminds me a lot of the early PHP days. PHP made it easy for independent, inexperienced programmers to create dynamic web applications. Which was great. But having grown up and seen the world, I've rarely seen or worked with small teams of professionals, fluent in several languages, who have decided that PHP is the best way to implement a website. But hey - whatever floats your boat.
- mattdennewitz 18y agoas a former client used to say to me, "if i wanted a django developer, i could hit a few websites or forums and maybe find one. if i wanted a php developer, i could walk out into the middle of the street and start shouting, and find several very quickly."
- bhiggins 18y agophp's popular because it's easy to get started. name a file .php and put it on your shared host and your code runs. unfortunately php doesn't get anything else right. i say this having used php for years. eventually you find that it wastes more time than it saves in the beginning. it is a terrible language with a terrible history, and i expect the future to be similar.
- moder 18y agoIt was the safe and easy install for shared hosting providers plus the easy deployment for web devs. Really, it's a simple recipe. I'm still wondering why Perl/Python/Ruby/$fave_lang doesn't just mix together the same ingredients and do the same thing.
- wehriam 18y agoSome of the greatest works of literature were written in German.
- pj 18y agoExactly what has PHP won? Most IT jobs aren't looking for PHP programmers. They don't make the most money. The most impressive websites are not built in PHP. PHP programmers don't have the most 'skills' so to speak. They aren't the smartest, contrary to their own opinion. This article is just for a bunch of fan boys to pat themselves on the back for picking PHP. PHP hasn't won anything.