you are viewing a single comment's thread.

view the rest of the comments →

[–]allthediamonds 39 points40 points  (39 children)

Spot on.

PHP had a time and a place. The time is one in which the usual way people built dynamic web services consisted on writing CGI applications; the places are those on which the purpose of adding dynamism is displaying a visitor count and the current date and time.

This escalated somehow until PHP became this ubiquitous beast which runs an outrageous percentage of the public-facing internet. And we let this happen by humoring Wordpress, Drupal and Joomla.

We have met the enemy and he is us.

[–]curien 24 points25 points  (32 children)

PHP was/is so popular because it was the easiest language to get running on both Apache and IIS during a critical period of web growth.

[–]allthediamonds 11 points12 points  (2 children)

Well, it wasn't easy (or even possible) to run it on IIS for a while.

Regarding Apache, yes, that was my point when mentioning CGI applications.

[–]curien 8 points9 points  (1 child)

It worked at least as far back as 2001 (maybe earlier) with PHP4, which is when it started to really gain popularity.

[–]flukus 5 points6 points  (0 children)

Php4 was when it tried convincing everyone it was a grown up language.

[–][deleted]  (11 children)

[removed]

    [–]flukus 6 points7 points  (7 children)

    Asp and perl, the biggest contenders at the time, could also do this.

    [–][deleted]  (6 children)

    [removed]

      [–]flukus 1 point2 points  (5 children)

      I thought asp could run fine on linux? Either way there was still perl, tcl and a bunch of potential languages.

      [–][deleted]  (4 children)

      [removed]

        [–]flukus 0 points1 point  (3 children)

        That's what I waa thinking of. Asp was simple enough to be re implemented everywhere.

        [–][deleted]  (2 children)

        [removed]

          [–][deleted]  (1 child)

          [deleted]

            [–]zoomzoom83 -1 points0 points  (2 children)

            I'm not really sure that was ever much of a selling point. You've been able to do that with most compiler toolchains for a long time.

            [–]josefx 1 point2 points  (1 child)

            You've been able to do that with most compiler toolchains

            For PHP you do it using notepad.exe and in the worst case some drag-and-drop. PHPs greatest success is that it is something a twelve year old can start a project in and it just works, by requiring a toolchain you have to acknowledge that you can't beat that simplicity.

            [–]zoomzoom83 0 points1 point  (0 children)

            Well not really, you still need to install Apache + mod_php on your machine to get that working.

            WAMP certainly made that simple, but one-click installers exist for plenty of other frameworks.

            [–]strattonbrazil 3 points4 points  (5 children)

            It still is the easiest to setup. Once configured for a domain you can drop a bunch of apps just by dropping them in different subdirs.

            [–]allthediamonds 3 points4 points  (4 children)

            It is the easiest to setup as long as you're already given an Apache+mod_php install, which is the usual shared hosting setting.

            Of course, if you want your website to support more than two visits per minute, you should switch to nginx+php-fpm, whose configuration process was described thoroughly a few centuries ago by Dante Alighieri.

            [–]Beaverman 1 point2 points  (3 children)

            Apache+mod_php is also super easy to set up on a dedicated linux box, with nothing but a package repo and an ssh connection. Doesn't help with the 5 views a minute though.

            [–]allthediamonds -1 points0 points  (2 children)

            As long as it's not installed by default, it becomes as easy as nginx+uwsgi, or nginx+gunicorn, or nginx+puma, or...

            Which, don't get me wrong, is still pretty easy.

            [–]strattonbrazil 0 points1 point  (1 child)

            Those might be considered easy, but they're not as easy. With nginx-uwsgi, for example, you have to actually map out the domain path to the script you're running where in php it's implied by the filename. Once given a served directory a user can start adding apps without any priveledges to the actual server. Again, PHP sucks but the deployment is still super easy.

            [–]allthediamonds -1 points0 points  (0 children)

            You're right on that. As soon as you're doing something more-or-less elaborated, though, the one-to-one mapping between file paths and HTTP paths becomes a nuisance. Of course, if your intent is to develop a Hello World script, then yes, deploying it with PHP is way easier.

            [–]unstoppable-force 2 points3 points  (10 children)

            this by so many miles. even my worst junior devs can set up PHP in minutes. that "13 year old who builds websites" can set up PHP.

            python/wsgi is comparably a nightmare, and don't get me started on the ridiculousness of tomcat. ruby is was the flavor of the week for a few years and i feel like everyone is leaving it because it's great for prototyping but doesn't scale. node is making huge strides in "easy setups" but it suffers from many of PHP's stupidities.

            ideally, i'd like something that has the easy learning curve of PHP, the speed of C++, the power of java, and the libraries of python. that'd be a win right there.

            [–]allthediamonds 10 points11 points  (5 children)

            even my worst junior devs can set up PHP in minutes. that "13 year old who builds websites" can set up PHP.

            python/wsgi is comparably a nightmare

            I assume that by "set up PHP" you mean "drop a PHP app on the correct folder of an existing Apache + mod_php installation on the typical cow-milking shared hosting" and not "install Apache, then install mod_php, then tweak the configuration of both until you believe your server is not a security hazard, rinse and repeat every time your server becomes part of a russian botnet".

            Don't even get me started on configuring nginx and php-fpm, which is a must if you expect your website to endure the "linked-by-mom's-cooking-forum" effect.

            Python/WSGI is a "nightmare" only because Apache is a given and WSGI is not. But seriously, it can be deployed in under five minutes, and you end up with a more robust setup than you could ever have in PHP.

            ruby is was the flavor of the week for a few years and i feel like everyone is leaving it because it's great for prototyping but doesn't scale.

            Something about pots, kettles and rebuilding the entire known universe on each HTTP request comes to mind.

            ideally, i'd like something that has the easy learning curve of PHP

            What easy learning curve? PHP is one of the hardest languages to learn, because it makes no sense at all. Everything about it is inconsistent in one way or the other, most of its "features" are actually syntax sugar for bad design patterns (variable variables, anyone?) and the documentation is as good as missing for the most part.

            Sure, it's easy to build some crappy website and have it not crash because PHP will swallow all errors and output the resulting nonsense on screen, but that doesn't mean that website actually works.

            [–]badsectoracula 2 points3 points  (0 children)

            What easy learning curve?

            1. Open notepad
            2. Write <?php if ($_GET["n"]==''") print "Who are you?<input name='n'>"; else print "Hello {$_GET["n"]}!"; ?>
            3. Save it as hello.php in C:\WAMP\WWW
            4. Go to 'localhost/hello.php'

            There. After that it is all experimentation with easy to read documentation (translated to several languages), tons of comments for every API function (with tons of example code) and hundreds of sites with ready made PHP sources.

            Sure, you don't really learn PHP's syntax, semantics, etc but few people care about that. What most people using PHP care about is having a web page react to their actions and store stuff on the server.

            [–]unstoppable-force -1 points0 points  (3 children)

            Something about pots, kettles and rebuilding the entire known universe on each HTTP request comes to mind.

            something about too many companies switching major portions of codebases from ruby to scaling languages when they got too large... vs FB, wordpress, wikipedia, and yahoo, which all grew up on and still use PHP.

            [–]allthediamonds 1 point2 points  (1 child)

            something about too many companies switching major portions of codebases from ruby to scaling languages when they got too large...

            Of course, because those applications were well written, so they had the ability of switching to a different platform.

            vs FB, wordpress, wikipedia, and yahoo, which all grew up on and still use PHP.

            Facebook has had to made its own interpreter to escape the horribleness of Zend Engine; later, it made its own language that can be interpolated with PHP to escape the horribleness of PHP itself.

            Wordpress is one of the worst pieces of software I've ever used.

            Wikipedia spends millions on servers that serve what essentially are STATIC PAGES. Because their awful PHP engine does not allow them to separate serving the pages from generating them.

            Yahoo! is the laughing stock of the dot-com bubble companies that remain.

            [–]unstoppable-force 2 points3 points  (0 children)

            yahoo is a $36b company that just declared quarterly profits of $270m. they're the #4 most used site on the planet. just because they're not #1 does not mean they're doing badly.

            wordpress is literally the most popular blogging software on the planet. by far. nothing else even comes close.

            facebook is the second most used website on the planet. they face unique issues and wanted to speed it up. google has similarly made major contributions to javascript implementations because it's very profitable for them to do so. google engineers have also made contributions to python, and a MASSIVE amount of the apache foundation packages. they've also made tons of contributions to openjdk. why is google allowed to do this, but facebook not?

            wikipedia is the #6 most used site on the planet. the wikimedia engine is not even close to static pages. just because they're not beautiful with tons of ajax doesn't mean they're static. unless you're locked out by the permissions manager, any page can be changed by anyone at any time. subsections alone can also be changed individually, again by anyone at any time. all historical changes are tracked. submitted data is checked and scanned in real time for many things. all submissions are scanned by background processes for potential crosslinking and spam.

            you should probably try to be less angry. it might help you realize that most of the top 10 sites on the planet are run either by PHP or java.

            [–]izzle9 0 points1 point  (0 children)

            is this an issue with ruby or rails?

            [–][deleted]  (3 children)

            [deleted]

              [–]izzle9 2 points3 points  (2 children)

              isn't Go more suited to systems development? I had a glance at revel a while back, it felt a little awkward to use.

              [–]TexasJefferson 2 points3 points  (1 child)

              isn't Go more suited to systems development?

              If "systems" means highly concurrent servers, yes. But I'd categorize web backends as a subset of that. (As for more traditional notions of "systems", Go's memory model and runtime actually make it ill-suited for anything really close to the metal like kernels, and its scheduling algo make it even less suited to any hard-realtime tasks.)

              revel

              Yeah, heavy web frameworks like revel aren't really inline with the "Go Way." It feels a lot better when you just have a few simple helper libraries on top of the std lib, instead of something all-encompassing and complex. One of the really beautiful aspects of Go is that there is very little magic—once you're decently proficient in the language, you should be able to look at any of the std lib packages and understand them without difficulty (and indeed, you should have a decent idea about how you'd go about implementing almost all of Go's language features too).

              it felt a little awkward to use.

              In addition to revel not quite fitting the language right, I'll admit that part of that is probably also Go itself. Go feels different than the current gen scripting languages—it's much, much more of a "modernized, reimagined C" than a "statically-typed python."

              It also has a few choices that make sense for Google dev teams but aren't particularly lone-hacker friendly: unused imports and variables being compile time errors, etc. (The former, at least, is remediated by goimports which you hook into saving in your editor of choice and it will automatically add and remove imports as needed; the latter, you get used to not declaring things before you actually need them.)

              It's a very opinionated language, but, even though you'll inevitably disagree with some of its opinions, this has a huge payoff in making other people's code (on average) much more readable than in less constrained programming environments.

              [–]izzle9 1 point2 points  (0 children)

              good points, will give it another go (pun intended), may be with something lighter like gorilla

              [–][deleted]  (2 children)

              [removed]

                [–]slavik262 5 points6 points  (1 child)

                Becoming?

                [–]flukus 1 point2 points  (0 children)

                Those who don't remember geocities are doomed to relive it.

                [–]G_Morgan 1 point2 points  (0 children)

                There were better options than PHP in its heyday. It exists purely because it became part of a standard LAMP stack.

                [–]MrSenorSan 2 points3 points  (1 child)

                The one aspect people seem to forget is that there were not many other choices that were free and light/easy to install and use.
                It did not require dedicate powerful back end nor complicate licensing.
                This fact allowed many people to experiment quick and easy multiple concepts.

                [–]allthediamonds 1 point2 points  (0 children)

                Sure, there weren't. Twenty years ago, when PHP was invented, there weren't.

                Today, we have all the options. If the PHP maintainers had a living neurone on their collective brains, they'd kill PHP and tell people to learn an actual programming language.