
Why PHP won - eries
http://startuplessonslearned.blogspot.com/2009/01/why-php-won.html
======
brlewis
This 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.

~~~
icode
I 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.

~~~
tlrobinson
Wait, was this a joke? I honestly can't tell.

~~~
vlad
I don't think it is. The bleeding edge of Web 1.0 or even Web 2.0 development
required a LAMP stack.

The author says that compared to programming desktop applications (all of the
languages he mentioned), the web based stack of MySQL, PHP, and Linux better
allowed him to create apps that users wanted.

Developers who started with PHP and moved up to Ruby and Python may not
realize that older developers who started with Assembler, Basic, and C++ find
any kind of web development a huge improvement for them. And, a productive
single person would by definition try to extend and improve their app instead
of learning new languages unnecessarily every 6 months.

~~~
icode
Not only compared to desktop applications was LAMP a huge advantage, but also
compared to Microsofts Web-Technologie (IIS,MS-Server,ASP and later .NET). I
was able to create apps the user wanted in the years I used MS technologie,
but I did not like it very much. When I discovered LAMP it was like YEAH! and
I stayed at home and coded away for weeks and some great stuff came out of
this.

As for the language (you mention moving "up" to Ruby or Python), I dont really
care if I do

    
    
      str_replace('stuff','zen','stuff and the art not to care');
    

or

    
    
      'stuff and the art not to care'.kickasstransform('stuff','zen');
    

or whatever the latest hottness is :-)

When it comes to things that matter, I dont miss anything in PHP. For example,
Javascript is a cooler language, because it has first class functions and all
that crazy shit. Ok, I dont mind that. But on the other hand, I HATE with a
passion that "a=7" will by default put "a" into the global scope in
Javascript. That outweights all the advanced tech in Javascript.

But the language itself is not the most important factor. Most important is
all the stuff that surrounds it. When I use PHP, I get new servers within a
click with any company i choose. I get the LAMP stack installed by putting an
Ubuntu CD into any machine, install it and do "apt-get install php5". On IRC,
there are tons of people on freenode#php (there aint many for Ruby for
example). And there is a very nice manual at php.net and so on.

And VERY important to me is the whole feeling about how L,A,M and P are
implemented. How I can use php on the command line, how I can start mysql from
the command line and give it commandlineparameters, how one table is
represented in MySql (one file for the structure, one file for the data and
one for the indexes), how a database is represented in MySql (a directory)...
There are millions of things I like. And they make me feel that the people who
wrote L,A,M and P at least partly think like me. Thats cool and makes me
productive.

~~~
pj
There must be something about a language that helps it map to our brains. The
creators of the language must be "like" its users in some way for the language
to make sense. Or perhaps it's the language that is the mapping between the
way the world works and the perception of that world in the minds of the users
and the creators.

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

~~~
lhorie
I'm a bit surprised that he didn't mention that PHP has very good
documentation - virtually every function has a plain-english description
(translated to multiple languages) followed by several usage examples and
snippets that solve common real-world issues.

~~~
Xichekolas
Yeah, clear documentation was _the_ reason I used php. In fact, it's the same
reason jQuery has become my javascript lib of choice. When documentation is
complete and centralized like that, the barrier to entry is vastly lower.

Rdoc tries to be that for ruby projects, but it still feels like a step
backwards. Google lessens the pain somewhat, but it's still nice to just hit
php.net/manual/en or api.jquery.com and find everything I need.

~~~
lhorie
You can also just hit php.net/whatever_you_are_looking_for and it will either
redirect to the docs for the most likely function or suggest functions with
similar names.

------
martythemaniak
To 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
The 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.

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

------
jimbokun
"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
>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> )

~~~
scott_s
jimbokun'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.

------
ars
You 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?

~~~
kuniklo
It's the old worse is better thing all over again:
<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?

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

------
jpcx01
I didn't realize that the game was over, and PHP won. Guess I should pack up
and go home.

~~~
pj
did 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.

------
smoody
Also, 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.).

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

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

------
gamble
I'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.

~~~
inerte
There'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 :)

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

------
senthil_rajasek
Also, don't forget the nice support for php (using fastcgi) on iis 7/6
<http://www.iis.net/php>

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

------
moder
It 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
Some of the greatest works of literature were written in German.

------
kingkongrevenge
PHP 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
Interesting. <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?

------
bhiggins
php'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.

