Become a fan of Slashdot on Facebook

 



Forgot your password?
typodupeerror
×
PHP Open Source Programming

PHP At 20: From Pet Project To Powerhouse 281

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."
This discussion has been archived. No new comments can be posted.

PHP At 20: From Pet Project To Powerhouse

Comments Filter:
  • PHP is great (Score:5, Insightful)

    by binarylarry ( 1338699 ) on Thursday June 11, 2015 @01:41PM (#49892775)

    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)!

    • Re:PHP is great (Score:5, Interesting)

      by Anonymous Coward on Thursday June 11, 2015 @01:59PM (#49892935)

      > 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.

      • Re:PHP is great (Score:5, Interesting)

        by Anonymous Coward on Thursday June 11, 2015 @02:12PM (#49893059)

        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.

        • by plopez ( 54068 )

          "everything to Java because it is easier to manage"

          Sounds like they want a waterfall and not Agile.

        • by damaki ( 997243 )
          Points cannot be compared between teams, you know. That's like agile 101. Even if you try to standardize the scale through teams, you cannot prove that these points are the same thing.
          If you start measuring productivity with points, your developpers are going to game the system and change their scale to achieve your said productivy. Sometimes, it happens unconsciously.
          If you say "it's too expensive" then, they are going to game the system to reduce points. In either case, you lose.
          Story points are just a
      • Re:PHP is great (Score:5, Informative)

        by Anonymous Coward on Thursday June 11, 2015 @02:20PM (#49893125)

        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.

        • 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.

          Is that a good idea? Maybe there should be a little more logic in between the libraries and the scripting language, for a variety of reasons including convenience and security.

          The only thing I hate about PHP is the way it cornholes your RAM.

      • Re:PHP is great (Score:5, Insightful)

        by phantomfive ( 622387 ) on Thursday June 11, 2015 @03:21PM (#49893667) Journal

        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.

        • Re: (Score:2, Interesting)

          by Anonymous Coward

          > vast majority of time spent on a software project is maintenance?

          True, but the company needs to survive long enough to get to that point. Out of the fifteen start-ups I've worked for in Seattle since the first one in 1983, most failed before we got to the point where we started to do maintenance. Most failed because .NET and Java apps take so much time and effort to get to a minimum product. Having to do maintenance, even if it is harder, is a high quality problem. It means you've survived longer t

          • Most failed because .NET and Java apps take so much time and effort to get to a minimum product.

            If that's your problem, it's lousy programmers not lousy platforms.

            Like, if it takes you much longer to get a web page up in ASP than in PHP, something is wrong with you. The effort of setting up the framework is not very heavy.

      • by Bogtha ( 906264 )

        the PHP code is harder to maintain long term, but it's amazing how fast you can build things that work.

        Quick doesn't have to mean dirty [eev.ee]. You can be extremely productive without creating unmaintainable crap in an ugly, badly-designed language. It's not a trade-off, you can have a better language and better productivity at the same time.

    • Re:PHP is great (Score:5, Informative)

      by CastrTroy ( 595695 ) on Thursday June 11, 2015 @02:06PM (#49893001)

      PHP is a truly terrible language, with a truly terrible API. Just look at functions like implode [php.net], 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 [php.net] vs. mysql_real_escape_string [php.net]

      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.

      • Don't even get me started on mysql_escape_string [php.net] vs. mysql_real_escape_string [php.net]

        If you see anyone using the mysql extension then they deserve to receive as much shit as you can give them. It was outdated in 2004. People should be using PDO [php.net] these days.

    • Indeed. PHP is one of the shittiest languages ever implemented.

      * https://wiki.php.net/rfc/incon... [php.net]

      It tends to bring out all the language apologists who are in denial over how shite it is:

      * http://www.reddit.com/r/lolphp... [reddit.com]

      It makes crappy Javascript look good in comparison:

      * http://strilanc.com/visualizat... [strilanc.com]

    • Re:PHP is great (Score:5, Insightful)

      by RyuuzakiTetsuya ( 195424 ) <taiki@c o x .net> on Thursday June 11, 2015 @02:27PM (#49893193)

      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.

      • by tepples ( 727027 )

        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.

        What does it do that Python's repr or json.dump or json.dumps fails at?

      • by Bogtha ( 906264 )

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

        You can do far better than that. If you use a tool like the Flask debug toolbar, you can jump into an interactive debug session, running on the server, right from your browser.

    • Comment removed based on user account deletion
  • Holy crap (Score:5, Funny)

    by DoofusOfDeath ( 636671 ) on Thursday June 11, 2015 @01:54PM (#49892879)

    "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.

  • Why PHP Won (Score:5, Informative)

    by Anonymous Coward on Thursday June 11, 2015 @02:02PM (#49892967)

    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.

    • Re: (Score:3, Interesting)

      by Anonymous Coward

      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.

      • Re:Why PHP Won (Score:5, Informative)

        by Ksevio ( 865461 ) on Thursday June 11, 2015 @03:47PM (#49893861) Homepage
        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.
        • by gnunick ( 701343 )

          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.

          Very appropriate choice of words. I hope I'm never asked to make such a mess (i.e., write code in PHP or JSP), ever again. Separation of concerns is key to maintainability, and this style of development is obsolete.

    • A short "Hello World" is a neat trick, but when you write PHP, how do you avoid security vulnerabilities?
      • by guruevi ( 827432 )

        The same way you avoid vulnerabilities in other programs - you write good code and/or become a better developer.

        I can concatenate SQL strings in pretty much any language and a language that prevents me from doing so is hopelessly overcomplicated. I don't mind a library forcing me to use safer methods but if the language prevents me from sending a custom SQL or LDAP query, it's broken.

      • Same way you do for just about any other language - don't trust any input given. Check it for type, check it for how it was delivered (POST vs GET vs reading from file/stdin/whatever), check it for a (sane) value, deal with unexpected or missing values in a sane way, etc. When using SQL stuff use PDO or mysqli class/functions to use prepared statements.

    • by Tablizer ( 95088 )

      Yeah, but THIS looks more like real work:

      writerContext rc = new writerContext(); rc.setWriterManager(this.System.io.contextManager.writer(rc.defaultsContext()));
      helloWriter hw = new helloWriter(rc);
      messageManager msg = new messageManager("Hello world!");
      hw.setMessage(msg);
      system.io.write.html(hw);
      system.io.writePendingBuffer();

      Nobody will feel like paying you big bucks unless it looks hard to do.

  • A poor workman... (Score:5, Insightful)

    by helixcode123 ( 514493 ) on Thursday June 11, 2015 @02:03PM (#49892975) Homepage Journal
    ... 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...".
    • by carlhaagen ( 1021273 ) on Thursday June 11, 2015 @02:09PM (#49893031)
      As a Perl programmer of 10 years and a PHP programmer of 15 years: this equally swings both ways.
    • by Gestahl ( 64158 )
      A great workman doesn't work with inferior tools, and so he has no need to blame them.
    • Re: (Score:2, Insightful)

      by phantomfive ( 622387 )
      Adapted from The Tao of Programming:

      The Tao gave birth to machine language. Machine language gave birth to the assembler.

      The assembler gave birth to the compiler. Now there are ten thousand languages.

      Each language has its purpose, however humble. Each language expresses the Yin and Yang of software. Each language has its place within the Tao.

      But do not program in PHP if you can avoid it.

    • Re: (Score:2, Insightful)

      by vilanye ( 1906708 )

      You are misusing that saying.

      What it means it that a good craftsman knows not to use substandard tools.

      A good programmer knows not to use substandard languages like PHP.

      I love that it exists because it is an easy and accurate resume filter. PHP on it? Delete it!

      • by Jack9 ( 11421 )

        > A good programmer knows not to use substandard languages like PHP.

        A good programmer understands what standards to adhere to.
        Try not to be a stickler for metrics that have become religious for you, as they do not seem to be significant barriers to existing projects.

        • PHP is a significant barrier for existing projects.

          Look at the pile of crap that is Wordpress or any PHP CMS for that matter.

          Ask Facebook how much money and time they have spent trying to hack around PHP's many warts.

          • by kuzb ( 724081 )

            ...and yet, despite all the issues you see with PHP, they're still using a language derived from it. Even though they have more than enough manpower and money to remove it entirely if they so choose.

          • by Jack9 ( 11421 )

            Did PHP kill your mother? What is the metric for being horrible? Is it based on lack of adoption or is it some score or is it something you only know when you see it?

            > PHP is a significant barrier for existing projects.
            > Look at the pile of crap that is Wordpress or any PHP CMS for that matter.

            WP is confusing, unmaintainable code, except for the brave few who do. Those outliers aren't really important in the grand scheme. I have encountered many proprietary CMS systems that were maintainable and maint

    • Re: (Score:3, Insightful)

      I'll probably be downmodded but I'm going to call horseshit on that cliche. While it may be PC to be in denial over crappy tools, the fact remains some tools (programming languages) are well designed and others are not. So yeah, um, no, I don't buy that argument that a poor craftsman blames his tools. It is the good craftsman that is able to spot the crap tools DUE to experience of having used good ones AND crap ones that they can tell what is complete shit.

      Second, just because you CAN write code in Brain

      • The == operator is broken

        The same is true of JavaScript, which is why Douglas Crockford in JavaScript: The Good Parts recommends always using ===. PHP developers would be wise to read that to see what warts PHP shares with some other popular languages.

      • by geminidomino ( 614729 ) on Thursday June 11, 2015 @04:23PM (#49894143) Journal

        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.

    • To which someone added "With ten lines of commentary to describe what the line does."
    • ... blames his tools.

      I wish this fuckling meme would die a thousand deaths, because it's so much bullshit. Good workmen ensure they have good tools. I have plenty of mediocre tools because I can't afford the very best ones.

      I recently had some contractors in to replace my roof. Almost everything they had was Makita or Hilti. There wasn't a single 25 quid Homebase special power drill in sight. They always used the drills costing hearly half a grand. Why?

      Because a Hilti drill is better in every single way (jus

  • by Hognoxious ( 631665 ) on Thursday June 11, 2015 @02:08PM (#49893017) Homepage Journal

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

  • 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.

    • by ArcadeMan ( 2766669 ) on Thursday June 11, 2015 @02:26PM (#49893179)

      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...

      • by drinkypoo ( 153816 ) <drink@hyperlogos.org> on Thursday June 11, 2015 @02:55PM (#49893475) Homepage Journal

        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

    • I'm sorry, but web page generation language is "niche"?

      I don't necessarily disagree with anything else you said, but I just found that an odd statement considering the ubiquitous of the web in modern times.

      • Yes, it is. There are plenty of languages that can cleanly generate web pages and system and application development. Web frontends are important and popular, but hardly the end-all be-all of modern programming. PHP is losing a lot of ground to single-page frameworks like AngularJS. It never had ground for backend platform development outside a handful of visible companies: for every Facebook, there are 100 companies with Java or Python infrastructure platforms.

        I contend that PHP is good at exactly one thin

        • >that fetch the same data through REST But, wouldn't you need something like PHP to hit the database and create JSON data to return to the REST call?
      • by ADRA ( 37398 )

        Realistically speaking, you'd be truely astonished about how much code actually gets written behind the scenes that never show up in 'things you see'. It makes a big difference when determining the true scope of software development as a whole. According to Google, there's around 18 million software developers in the world. They all aren't writing front-ends to your latest social media web site.

        Its not surprising that PHP is a popular deployment platform for one painfully obvious reason: Hosting. Well, and

      • I'm sorry, but web page generation language is "niche"?

        I don't necessarily disagree with anything else you said, but I just found that an odd statement considering the ubiquitous of the web in modern times.

        Personally, I lost interest when the GP made it clear they consider PHP only good for generating web pages, and that it does nothing to help users write sane readable code (It's so so easy to write sane reliable reusable PHP that the next wet behind the ears college grad can make sense of and build upon, pretty much just don't be lazy, identify the PHP version, and use all the general programming language-agnostic skills like structuring and commenting.... Just because it doesn't force you to do something d

    • 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.

      Yes......to the point that you might be better off writing your own custom parser rather than using PHP. You'll be at a lower risk of security vulnerabilities, anyway.

    • by amicusNYCL ( 1538833 ) on Thursday June 11, 2015 @06:07PM (#49894771)

      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.

  • by jtara ( 133429 ) on Thursday June 11, 2015 @02:29PM (#49893209)

    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.

  • Just like good Perl is possible. That being said, if you are going to take the time to write correct, well-architected, maintainable, etc. system, you will spend equal amounts of time in any language or framework. PHP makes some things very easy, but that easiness is skin-deep, and it's exactly the same with Ruby on Rails. Yeah, you can rapidly prototype things and get stuff running in front of people. Scaling it, making it robust, and making it part of a whole ecosystem of mutually self-supporting tool
  • 80% is misleading (Score:4, Insightful)

    by Guspaz ( 556486 ) on Thursday June 11, 2015 @03:01PM (#49893527)

    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.

    • by Bogtha ( 906264 )

      More specifically: if PHP is installed on a server, it typically advertises itself in the Host: HTTP header for every outgoing request, regardless of whether it was used to serve that request or not. Most other languages do not, even if they were used to serve that request. The tools that perform these language surveys can't adequately control for this, so it leads to a phenomenally large overestimation of the usage statistics for PHP.

  • You misspelled "Whorehouse" guys...
  • PHP is the shitiest language out there except for all of the others.

He has not acquired a fortune; the fortune has acquired him. -- Bion

Working...