Slashdot Mirror


PHP At 20: From Pet Project To Powerhouse

snydeq writes: Ben Ramsey provides a look at the rise of PHP, the one-time 'silly little project' that has transformed into a Web powerhouse, thanks to flexibility, pragmatism, and a vibrant community of Web devs. "Those early days speak volumes about PHP's impact on Web development. Back then, our options were limited when it came to server-side processing for Web apps. PHP stepped in to fill our need for a tool that would enable us to do dynamic things on the Web. That practical flexibility captured our imaginations, and PHP has since grown up with the Web. Now powering more than 80 percent of the Web, PHP has matured into a scripting language that is especially suited to solve the Web problem. Its unique pedigree tells a story of pragmatism over theory and problem solving over purity."

27 of 281 comments (clear)

  1. PHP is great by binarylarry · · Score: 5, Insightful

    The great thing about PHP is that it's the one language that native, Java, .NET, python and ruby guys can all make fun of together.

    Here's to another 20 years (or maybe 19, depends)!

    --
    Mod me down, my New Earth Global Warmingist friends!
    1. Re:PHP is great by Anonymous Coward · · Score: 3, Insightful

      Programming languages are complex things. Just because you're not fit to use the tools properly doesn't mean the tools are to blame.

    2. Re:PHP is great by Anonymous Coward · · Score: 5, Interesting

      > can all make fun of together.

      I'm a Java dev of nearly twenty years, and I used to make fun of PHP. That was until my company added a team of PHP developers to work on prototypes. Over the past eight years, they have constantly exceeded the productivity of my Java devs by more than tenfold. Yes, the PHP code is harder to maintain long term, but it's amazing how fast you can build things that work. It is the best glue language I've ever seen. Basically it's just a thin shim between C libraries, and no one can argue with the quality and expansiveness of the C libraries available for Linux. PHP lets us use them very, very quickly in web, command line, and GUI apps. The only real weakness I've seen is that PHP-GTK is not very well maintained.

    3. Re:PHP is great by CastrTroy · · Score: 4, Informative

      PHP is a truly terrible language, with a truly terrible API. Just look at functions like implode, which can accept parameters in either order. Also (according to one commenter), imploding an array of booleans results in the "true" values being converted to 1, and the "false" values being converted to empty string. That's just a single function. Don't even get me started on mysql_escape_string vs. mysql_real_escape_string

      The only reason it's so popular is that for such a long time it was the only choice for server side languages on a shared hosting environment. Even now there aren't really any good alternatives. Shared hosts still don't allow things like Java,.Net, or Node.JS on the server side unless you are prepared to pay a premium. Many hosts don't even offer Ruby, or Python, even though they don't require a constantly running process.

      PHP started off as a toy project, and although a lot of work has been done to add functionality to make it useful, it still shows that it was lacking a lot of design considerations. Object Oriented capabilities and namespaces were tacked on later, and it really does feel tacked on, because only a very small part of the available libraries use object oriented features.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    4. Re: PHP is great by Anonymous Coward · · Score: 3, Insightful

      No it really is a pile of garbage. The fact that it continues to work at all is a testament to the commitment of the maintainers to continue tilting at that particular windmill.

      Why garbage? Here's why:

      1. Standards change all the time. What's the default value for that global? Depends upon the version. What? That global didn't exist when you wrote your code, so you can't check its current value to see if it affects you? Go fuck yourself.

      2. Libraries and APIs are added, replaces, and sundowned at will. Want to do an http redirect in the current version? Go fuck yourself!

      3. Error handling. Look it up. Or, rather, the designers need to do that and then implement something sane, and do it consistently.

      PHP is the only very popular language that is worse than Perl. At least Perl has some advantages to it that make you tolerate the shitty parts. I was about to write "the only thing that PHP has going for it is..." but everything I could come up with to finish that sentence wasn't true.

      It's utter rubbish.

    5. Re:PHP is great by Anonymous Coward · · Score: 5, Interesting

      exceeded the productivity of my Java devs by more than tenfold

      On my team of twenty-one devs, we have eleven Java guys and three PHP guys. We do fortnightly sprint planning meetings and score backend tasks as a group. The Java guys do about 50 points per sprint of work. They're very consistent and dependable, which is nice from a management point of view. For the PHP tasks, we schedule 75 points per week. The PHP guys, over the past three years we've been doing this, are doing 5.5 times as much per developer. PHP is amazing.

      The problem is that on a per-Sprint basis, the PHP guys are very inconsistent. Sometimes they'll do two to three times as many points as we planned on, and in a few sprints, they got no points. So even though they're five times more productive on average, our management wants to move everything to Java because it is easier to manage. Also, since we recently released v1, we know PHP maintenance tasks are going to be even more inconsistent wrt time to fix.

    6. Re:PHP is great by Anonymous Coward · · Score: 5, Informative

      thin shim between C libraries
      That is a great point. Since the Microsoft fanbois hate Linux, they hate PHP. PHP is basically a way to call C libraries. That is why the library naming conventions in PHP are so inconsistent. It's because PHP is exposing those libraries, with all of their individual quirks, to an easy to use scripting language.

      Where I work, we converted a C-based CGI program that was developed from 1994 until 2009. At peak, I think we had nine C developers working on it. It took us only six months with three PHP developers to write a good PHP replacement that called our C libraries. Now I have two new college grads that are very productive adding features to the web site whereas before, I had expensive C programmers each with more than ten years of experience that took dozens of times longer to complete tasks. PHP has cut our development overhead by probably 80%. Now the three remaining C programmers can work on interesting projects rather than on web pages. PHP has, and this is not an exaggeration, saved my company.

    7. Re:PHP is great by RyuuzakiTetsuya · · Score: 4, Insightful

      I'm currently developing in python after 7 years in the PHP world.

      There are a lot of PHPisms I have grown accustomed to, that I would really like in PHP. Namely, I want var_dump.

      PHP makes a lot of sense to me from the context of a kid who wrote awful raw HTML pages. I just wish we had a mode for PHP that wasn't "here's a pretend HTML page" for all sorts of backend logic. That's the only thing I want from python that isn't in PHP. WSGIServer is a boil on the ass of the python world.

      --
      Non impediti ratione cogitationus.
    8. Re: PHP is great by oobayly · · Score: 5, Funny

      mysqli_real_escape_string has been deprecated. You should be using mysqli_real_escape_string_honest_guv_we_won't_change_this_again

    9. Re:PHP is great by phantomfive · · Score: 5, Insightful

      Yes, the PHP code is harder to maintain long term,

      Do you understand that the vast majority of time spent on a software project is maintenance? If you optimize for the initial development, you are wasting your time.

      The only real weakness I've seen is that PHP-GTK is not very well maintained.

      ok, now you're just trolling.

      --
      "First they came for the slanderers and i said nothing."
    10. Re: PHP is great by zieroh · · Score: 5, Insightful

      No it really is a pile of garbage.

      The very best programmers that I've encountered in my long career were the ones that could make the code sing (figuratively speaking) regardless of the environment. Any language, any OS, any hardware -- none of these things ultimately matter. All those things will be replaced by something better (or maybe worse) at some point in the future. Being able to put aside juvenile biases and petty preferences is a hallmark of the truly great programmer.

      The very worst programmers that I've encountered were the ones that bitched and whined endlessly about minute details, or those who let their pure philosophical ideals get in the way of the task at hand. They adopt stupid star-belly-sneetches attitudes for the sake of appearing smart among their peers, slagging that which they do not approve of.

      Guess which one you are.

      --
      People who say "sheeple" have about as much sophistication as an AOL user, and in fact are probably actually AOL users.
    11. Re: PHP is great by zenbi · · Score: 5, Informative

      Try using it. It's an alias to another function that requires an optional library that ... doesn't implement the function.

      What? HTTP redirects with the header() function have been simple and consistent the entire lifetime of the language. The function is not an alias and does not require an optional library as you claim. I especially like that it exposes the underlying HTTP headers of the protocol instead of wrapping the redirect into some type of hidden Response.Redirect() type function. This "lower level" makes understanding and debugging redirect problems much more obvious.

  2. Holy crap by DoofusOfDeath · · Score: 5, Funny

    "PHP has matured into a scripting language that is especially suited to solve the Web problem."

    This almost makes me wish Dice would go back to starting its flame-wars with stories on gender inequality.

  3. Why PHP Won by Anonymous Coward · · Score: 5, Informative

    Hello world in PHP:

    Hello world!

    No Bullshit Boilerplate (TM), no needing 5KLoC of code and configuration, no application server to babysit 24/7, no need for catalina+tomcat+jakarta+jre+struts+hibernate+Xmxwtfbbq16GB, just load one module and every single customer sharing the server can use it... No need to understand the CGI protocol, no need to understand the HTTP protocol, no need to understand HTML even.

    1. Re:Why PHP Won by Anonymous Coward · · Score: 3, Interesting

      It's because in 1996 to do this on a web page:

      <? echo "Today is " . date("Y/m/d") . "<br>"; ?>

      Was AMAZING and easily understandable.

    2. Re:Why PHP Won by Ksevio · · Score: 4, Informative

      But you wouldn't do it like that because you could just do:

      Today is <?=date("Y/m/d");?><br>

      A big part of the appeal of PHP was how it could be mixed in to HTML documents to make a mess of server side and client side code.

  4. A poor workman... by helixcode123 · · Score: 5, Insightful

    ... blames his tools. Crap code an be written in any language. Good code can be written in PHP. While not my first choice of languages, I have found myself on PHP projects and been fairly comfortable using it although during moments of frustration put in comments such as "These following 10 lines could be written in the following one line of Perl...".

    --

    In a band? Use WheresTheGig for free.

    1. Re:A poor workman... by carlhaagen · · Score: 4, Insightful

      As a Perl programmer of 10 years and a PHP programmer of 15 years: this equally swings both ways.

    2. Re:A poor workman... by geminidomino · · Score: 3

      When the official docs has a page called Inconsistent Behaviours [php.net] you know there is a bigger problem

      My favorite part is where whoever wrote that page actually uses MySQL's behavior to defend PHP's typing stupidity.

  5. s/power/out/ by Hognoxious · · Score: 4, Funny

    It's definitely a house, but I'd disagree about the power part.

    --
    Confucius say, "Find worm in apple - bad. Find half a worm - worse."
  6. When does the powerhouse part start? by Just+Some+Guy · · Score: 4, Interesting

    PHP is Turing complete, so it's technically possible to write anything in PHP that you could write in another language. That seems to be about the most it's got going for it. PHP does nothing to help programmers write sane, maintainable code. It's almost impossible to develop without having a browser tab open to php.net ("The online docs are great!" "Well, they'd have to be."). There is zero consistency with things like argument order. Dangerous legacy concepts like "mysql_real_escape_string" are only recently deprecated and don't have a set removal schedule. It's a one-trick pony that's nearly useless outside its niche as a web page generation language. It's just a mess - a dangerous, unmaintainable mess.

    I won't refuse to use an app just because it's written in PHP, but I do heavily weight it when comparing alternatives. PHP is a powerhouse in much the same way as McDonald's. It may be ubiquitous, but it still sucks and you have to question the judgement of anyone who chooses it to start a new project.

    --
    Dewey, what part of this looks like authorities should be involved?
    1. Re:When does the powerhouse part start? by ArcadeMan · · Score: 3, Insightful

      When you need low-cost web hosting, PHP is quite often the only choice other than Perl.

      And Perl code looks like someone who vomited RegEx all over the place...

    2. Re:When does the powerhouse part start? by drinkypoo · · Score: 3, Interesting

      And Perl code looks like someone who vomited RegEx all over the place...

      To be fair, you don't have to write perl like that, and in theory the optimization is good enough to where you don't actually get anything out of it unless you miss line noise. People just tend to. They write technically beautiful perl, which is a sure road to making someone else cry later.

      I'm not an ubercoder so you can read my perl and I comment it so you can read it even more. So while some perl genius can do much more with perl than I can, my perl is probably more useful to future generations... unless we're going to cryogenically preserve some perl hackers

      --
      "You're right," Fisheye says. "I should have set it on 'whip' or 'chop.'"
    3. Re:When does the powerhouse part start? by amicusNYCL · · Score: 5, Insightful

      PHP does nothing to help programmers write sane, maintainable code.

      PHP does nothing to force programmers to write good code. It also doesn't force you to write bad code. It doesn't do anything, actually, other than waiting for you to use it however you want to. That means that the fact that you produce good or bad code is a reflection of your abilities instead of the language.

      --
      "Our two-party system is like a bowl of shit looking at itself in a mirror." - Lewis Black
  7. Party like it's 1995! by jtara · · Score: 4, Interesting

    I used the original, or close to it.

    In 1995, I worked for a company in San Diego (MediaShare) that did Tesco's first online store.

    MediaShare had a publishing tool called ProductBase, that put product details in a database, and you could publish to print or CD-ROM (remember those?). I proposed to my boss that we could also easily publish to HTML, and he let me explore it.

    This turned ProductBase into basically a static-site generator, and Mediashare built some sites for some of their existing clients ("the threes" - 3COM and 3M - we put the 3M Adhesives catalog and 3Com's catalog of network products online for the first time) and some new ones.

    One of the new ones was Tesco, and I built a little shopping cart with a very-close-to-1.0 PHP script running under Netscape Server CGI.

    I would have never thought that PHP would still be kicking around this many years later. That was the last time I ever used PHP.

    The author had no pretensions about PHP. It was a simple little script to help him with his personal home page, and he admitted his lack of programming expertise. Others turned it into a Frankenstein's monster.

  8. 80% is misleading by Guspaz · · Score: 3, Insightful

    PHP does not power 80% of the web, it is merely present on at least one server behind 80% of TLDs. That's not the same thing.

  9. Re:Cue non-programmers linking "A fractal of bad d by JustAnotherOldGuy · · Score: 5, Insightful

    Actually, you're mistaken. I understand exactly what I need to do to get the results I want, and doing it in PHP earned me a nice living. Using PHP (the LAMP stack, really) has allowed me to work for myself, create businesses, earn money, and live pretty well. I have a hard time understanding what you don't like about that, unless it's based in jealousy. If you don't like PHP, don't use it. You're welcome to use whatever programming language you like without fear of me telling you why you're "wrong".

    --
    Just cruising through this digital world at 33 1/3 rpm...