Why is PHP so popular? What can we learn from the PHP camp?

…and what can we learn from PHP’s rapid rise to success?

I’ve seen quite a few jobs which require PHP experience lately and I
wonder why; what’s PHP got that Ruby doesn’t?

A massive user base, for starters :slight_smile:
Speaking personally , I’m moving to ruby because Perl6 looks absolutely
horrible - why someone would break backwards compatibility in a 12 year
old language is beyond me - and if I’m going to learn another language
it sure as hell isn’t going to be Perl again!

I’ve done OOP in Java up to now, but being a BSD user I’m getting
frustrated at a cross-platform language which only has decent performance on
Sparc/windows/Linux.

Perhaps another interesting question to ask is: why has PHP not taken off as
a general-purpose scripting language?

I think the comparision between PHP and Ruby is a bit strained, since
PHP is (as others said) very closely tied to web development.
(I don’t know enough about eRuby to compare them).

If you want new users, wait for perl 6 to ship. Seriously.
Reading the Pickaxe I’ve felt a real head start for already knowing
regeces, etc, the language feels like Perl from the future…

Incidentally, I had a look at some of his PHP code, and it is written in a
very object-oriented style with lots of $this->dosomething(arg) calls. For
someone used to that horrible syntax, Ruby is an easy sell :slight_smile:
http://www.php.net/manual/en/language.oop.php

Again, versus Perls OOP (i.e. an afterthought bodged onto the language
where data encapsulation is impossible and you can see into all the
objects, and all that IS_A/Exporter:: stuff) Ruby is wonderful.

I have quick-and-dirty-thirty-liners with class definitions in now,
because it’s so straightforward.

THANK YOU MATZ for a scripting language where parts don’t snap off
the objects and choke small children.

···

On Mon, May 05, 2003 at 02:36:21PM +0900, Phil Tomson wrote:


Rasputin :: Jack of All Trades - Master of Nuns

(2) PHP comes with a huge library, and tightly integrated with
Linux/Apache (have anyone already heard about LAMP? Linux Apache MySQL
and PHP).

This is the main reason why I’m still using PHP for web development. I
don’t have enough C skills to bind libraries on my own, btw. has anyone a
good tutorial on this topic?, thanks!

And youre right, LAMP is a technical term in the meantime.

Dominik

(2) PHP comes with a huge library, and tightly integrated with
Linux/Apache (have anyone already heard about LAMP? Linux Apache MySQL
and PHP).

This is the main reason why I’m still using PHP for web development. I
don’t have enough C skills to bind libraries on my own, btw. has anyone a
good tutorial on this topic?, thanks!

And youre right, LAMP is a technical term in the meantime.

Dominik

Perhaps:

http://pickaxe.ruby-doc.org/string
http://pickaxe.ruby-doc.org/array

Ideally, of course, you could just do:

http://www.ruby-doc.org/manual/string
http://www.ruby-doc.org/manual/array

And the best information comes up.

-austin
– Austin Ziegler, austin@halostatue.ca on 2003.05.05 at 10:13:48

···

On Mon, 5 May 2003 22:30:53 +0900, james_b@neurogami.com wrote:

There’s the pick-axe book, and ruby-doc.org offers something akin
to php.net’s URL-based method look-up:

http://www.ruby-doc.org/find/pickaxe/string
http://www.ruby-doc.org/find/pickaxe/array

(Though I’m thinking now that that the base URL up to the search
term could be clearer or more intuitive.)

In article 032b01c3131b$65d04aa0$6401a8c0@MELONBALLER,

From: “Rich” rich@lithinos.com

Visit: http://www.php.net/manual/en/ for starters. Ruby is no where near
that level of ‘extra’ functionality. Sure, it could be done… but it has yet
to be done.

Which hints to the other reason PHP is so popular: Marketing and cost. Why
is Taco Bell more popular than El Palenque (on SE 17th; check it out, Phil)?

I’ll check it out… SE 17th and what’s the cross street?

Marketing and cost. (Since both Ruby and PHP are free, of course, “cost” in
that sense refers to difficulty of installation and learning curve.) PHP
was sold as a language for html-people… a programming language for
non-programmers. In fact, your old html pages already worked just fine as
“valid programs”!

Taco Bell doesn’t have to be good. It just has to be OK, cheap, and easy.

and the fact that it’s readily available doeesn’t hurt either.

I think the “Taco Bell” argument is why it became popular, and the “big
manual” argument is why people stick with it. (Well, that and the fact that
a lot of people stick with their first languages.)

It’s surprising to me that “real” programmers would use PHP, though, even if
they have other scripting languages to use.

However, it really doesn’t make any difference to me how popular Taco Bell
is; It doesn’t make El Palenque any worse. Perhaps the difference is that I
don’t think anyone would disagree with me that El Palenque’s food tastes
better… especially people who had never gone there. (I presume none of
you have ever been there, but you believe me that it tastes better, don’t
you?)

I haven’t been to El Palenque, but I have been to Taco Bell in the past
(hat to admit it) so I can readily agree that El Palenque is most likely
much better.

My Mexican food snobbery carries a certain weight, I suppose, and no
one who eats at Taco Bell is going to be snobby about their food. I think
everyone realizes that what Taco Bell does well is something other than
making the best Mexican food in the city, and few (if any) would claim it to
be the highest-quality Mexican food around.

I agree that often the better (language|restaurant) is often much better
than the more popular (language|restaurant). Maybe I could throw in
another Mexican restaurant: Baja Fresh. Baja Fresh is a chain, but they
make really very decent Mexican food (in fact I find their fish tacos
among the best). Now to really stretch the analogy: Baja Fresh probably
employs a lot more people than El Palenque. That doesn’t make one better
or worse than the other, but do you see where I’m going?

Now to leave the Mexican Restaurant analogy… Languages tend to build a
critical mass. Perl did this in the past and PHP seems to have done this
as well. To some lesser extent, Python has done this. What happens is
that these languages attracted enough attention
and developers so that any lack they had/have tends to be filled in by
people developing additional modules, documentation, etc. More developers
means more manpower (people power) available to improve things.

We can sit around and say that we don’t care about popularity because Ruby
is much better than the alternatives (and in our opinion it is) but then
if we don’t attract more people to the language, it’s going to stay small
and perhaps stagnate (which isn’t an issue in the restaurant business).

I guess the problem is that most programmers see programming languages as
more like religions than Mexican food. If I told you I was writing a new
programming language, wouldn’t you have at least a bit of scepticism,
perhaps even contempt? “Why another?” “Do you really think it will be
popular?” And so on. But what if I told you I was opening a new Mexican
restaurant? “When does it open? Are you going to have free chips and
salsa?”

Maybe, but PHP started out just like Ruby did, no? It was a free/open
source language. As far as marketing goes, I don’t think they had any
corporate funding for marketing, did they? (at least not until O’Reilly
started doing PHP books) The main point of my question
is not really to bash PHP, but to figure out what they did right in the
marketing/promotion department and try to emulate that so we can get more
Ruby developers. (So far several people have mentioned that PHP has
better documentation - so we’re back to the old documentation problem.)

More Ruby developers => More Ruby programs/packages/modules => more Ruby
visibility => More Ruby usage => Ruby jobs => More Ruby devlopers

It seems that it’s a feedback loop that tends to be self reinforcing.

Anyway, happy Cinco de Mayo! :wink:

Yes, happy Cinco de Mayo! Cinco de Mayo isn’t really Mexican Independence
day as is commonly thought (that’s September 12th) but it marks a victory
of the Mexican forces against the French in which the Mexican forces were
heavily outnumbered by the better trained and equiped French army. So
sometimes the underdog does win, that should give us hope :wink:

BTW: it’s amazing that what amounts to a fairly minor holiday in Mexico
is a five day celebration here in Portland, OR - any excuse for a party, I
guess. The 4th of July isn’t even celebrated for five days.

Phil

···

Chris Pine nemo@hellotree.com wrote:

----- Original Message -----

Seems like you get the worst of all worlds with Java: slow execution
speed,
I have to disagree here, good enough JITing would provide execution speed
very close to native, and modern VM’s do smart JITing.

The problem relies more on the VM’s memory requirements…

···


Idan

Aredridel wrote:

  1. PHP was designed to do one job and is great with this. Ruby is a
    general purpose language, that is good in a lot of places and
    unperfect in all.

PHP is also buggier than a swamp in the midwest US.

Oh yes, that’s true. I once tried to use non-blocking sockets… they
should be called non-working sockets, because they didn’t work in both
the windows and the linux version.

PHP was less designed than just kludged together.

The language itself is VERY ugly, this doesn’t need a discussion, and
you could fill a book with the history of security problems in PHP.

Building a ruby “Standard Library” of all this is, I think, the way to
go.

Full ack.

A very bazaar approach would work, I think: let the “reigning”
module developers maintain their modules as part of the library – I
would love to see REXML included, along with Ruby-Mysql,
Ruby-Postgres, DBI would be a must, and at least one graphics
processing library.

FXRuby seems to be another good candidate.

Andreas

···

On Tue, May 06, 2003 at 12:42:04AM +0900, Lothar Scholz wrote:


AVR-Tutorial, über 350 Links
Forum für AVRGCC und MSPGCC
http://www.mikrocontroller.net

Just wanted to mention that in all the replies so far no one has
mentioned Java. Applications servers built on J2EE and running Servlets
are on the rise and fast.

I would disagree there - I have never seen any Java application which is
fast! :stuck_out_tongue:

[snip]

Agreed. I usually end up waiting for pages ending in .jhtml… could be
worse, though.

Seems like you get the worst of all worlds with Java: slow execution speed,
the inconvenience of compilation, next to no type safety (see discussions
passim), and subtle dependencies on the exact version of Java VM as well
as on the underlying host OS.

Not really a problem on the server side: you throw hardware at it once,
and the platform doesn’t shift.

Ari

···

On Tue, May 06, 2003 at 05:12:50AM +0900, Brian Candler wrote:

On Tue, May 06, 2003 at 04:52:56AM +0900, E F van de Laar wrote:

“Chris Pine” nemo@hellotree.com schrieb im Newsbeitrag
news:032b01c3131b$65d04aa0$6401a8c0@MELONBALLER…

I guess the problem is that most programmers see programming languages
as
more like religions than Mexican food. If I told you I was writing a
new
programming language, wouldn’t you have at least a bit of scepticism,
perhaps even contempt? “Why another?” “Do you really think it will be
popular?” And so on. But what if I told you I was opening a new
Mexican
restaurant? “When does it open? Are you going to have free chips and
salsa?”

Hm, I thought this is what happens to new languages all the time: people
jump on it and try it out. Same as with restaurants, isn’t it?

I think the point where the parallel does not hold is existing code. You
can always switch your restaurant without loosing much (ok, the friendly
smile of the waiter might be considered a real loss :-)) ), while this is
much more difficult with an existing application. Even if there is a
migration tool there’s often enough to do left to scare people away.

Regards

robert

6) Rubies OO functionallity is not so important in CGI like scripts
   (this means scripts that start with no internal variables other
   then session variables).
   This would only be an important point if you use an application
   server, but there is none.

Why would a CGI application benefit less from OO than other types of
applications?

Because a CGI script (or better any non application server like
script) starts with zero data. It loads all data, processes them and
outputs the data. With this constellation there is often not much to do
so no need for a technical better solution.

Okay if you refer to monster applications (for PHP) like PHPNuke or
MySQL then you find that they could be written in 50% of the code when
using good OO. But there are so less applications of this size
(written - not used) that they don't count for PHP popularity.

8) Everyone can learn PHP in a week, because it is much simpler
   Even designer and low paid students, which is commercially
   important.

I don't know PHP too much, but I'd say that ruby is pretty easy to take
on. As many pointed out, it's far easier than perl for example.

As someone who speaks 10 computer languages it is not easier for me to
learn PHP as it is to learn Ruby. But there are still a lot of people
who don't understand OO, who don't understand regular expressions, who
don't have the discipline for good organization of modules, files and
there contents. Now you simply say: Okay, they must learn. But this is
not an always "commerciall" way to handle this problems. You pay less
and expect less but they still got the things done. This ist mostly
the thing you do with smaller websites (< 2000 Euro) where the only
thing you can do is find a student and let them work.

There are professionals with > 60.000 Euros and experience of 10 years
and they can't write a good OO program.

“Rasputin” rasputin@shrike.mine.nu schrieb im Newsbeitrag
news:20030507132627.GA49672@shrike.private.submonkey.net

THANK YOU MATZ for a scripting language where parts don’t snap off
the objects and choke small children.

Ai, ai! Nicely put. :slight_smile:

robert

Just wanted to mention that in all the replies so far no one has
mentioned Java. Applications servers built on J2EE and running Servlets
are on the rise and fast.

I would disagree there - I have never seen any Java application which is
fast! :stuck_out_tongue:

Actually, all the Java apps I’ve seen have not only been slow but also buggy
as hell when put under load (‘under load’ sometimes means three
keystrokes) which gives me a rather negative impression overall.

Client side Java - particularly GUI code - is absolutely awful.
‘Write once, debug everywhere’. Life’s too short.

Server-side, it’s a different story. The servlet API is a joy to use, and
speedwise it p*sses all over CGI. - being able to initialise your DB
connection when the server boots then re-use it is a real boon.

The rest of J2EE (EJB in particular) always seemed like overkill,
but then I don’t run legacy databases…

IMO, ruby appservers are the way to go, rather than a CGI-based approach
have persistent objects on the server, and spawn a new thread for each client.
The servlet model is A Good Thing for OOP code, as opposed to a
‘when the client connects fork off a shell with this in’ legacy approach.

Add a well defined interface to the container that your Ruby servlets
(Garnets?) run in, so you can get the same sort of portablility across
appservers Java gives you.

Once I know enough, I’ll be back here asking dumb questions to see what
I can do to make that happen.

Oh, and it’s an encumbered technology - I had to agree to terms and
conditions before downloading it.

For us up at the ISP, that’s not a new thing. But at least I can
choose tomcat over weblogic and pocket the difference if I want, without
a lot of porting hassles.

···

On Tue, May 06, 2003 at 04:52:56AM +0900, E F van de Laar wrote:


Rasputin :: Jack of All Trades - Master of Nuns

Sean Gilbertson wrote:

Good evening all,

My wish is for more hosting providers to support embedded-Ruby.  

Being able to run Ruby CGI scripts is great, but being able to embed
Ruby in HTML would make it my number-one choice for web programming, bar
none (assuming the modules I need are there).

Does anyone know of a good hosting provider which supports eRuby?
  • Sean
we do - and cheaply.

sadly the people doing our homepage are using jsp and are pretty bad at
it, so you will most likely see lots of tomcat exceptions if you try to
access our homepage (www.web-forge.dk).

In stead drop an e-mail to info web-forge.dk with your requirements
and I will have someone make you an offer. I am personally using ruby
end eruby on an almost daily basis and will make all modules awailable
to you (after making sure they don’t let everyone root our server).
</shameless plug>

it seems that most of the places that provide eruby also provide shell
access, and charge a huge amount for it…

commercial interests aside, if you have an opensource project then host
it at sourceforge and use ruby from there. It looks like they will let
you add .htaccess files and /cgi-bin/eruby… that should do the trick.

···


dc -e 4ddod3ddn1-0nn1dnd+nn3dn1+n3*1+ddn1+dn2-n5dn1+dnrn1-p | tr
0123456 yorh@k. | dd conv=lcase

PHP got where it is mostly by being old, and not being perl. While we
could learn from them, ruby’s current problem is not to duplicate what
PHP did, but instead to figure out what it needs to do now in order to
achieve the same kind of critical mass.

I’ve done a fair amount of PHP, ASP and JavaServlet programming. I’ve
done enough PHP to know I wish to do no more :P. So, now that I’ve got
some web projects again, I intend to use ruby. So, as a relative
beginner, my direct impressions are:

1.) Single source for all documentation info, with user added
comments, ala php’s manual. Very important that the cannocal way of
doing something is illustrated somewhere in this document, much like
php.
2.) A single “does all you need for ruby web programming” package.
Preferibly this would be what mod_ruby turns into, so that if you have
mod_ruby, you know you have what you need, at the most just a
–configure-with-blahblahblah away
3.) CPAN, nuff said
4.) A critical mass of tutorials on the web that assume zero prior
knowledge.
5.) Speed bragging rights

All these are important, but for attracting new users, #4 is
absolutely killer. The huge volume of PHP tutorials is what led me to
it originally. We need to get some folks from onlamp and elsewhere to
discover “hey, ruby is cool”. But they likely won’t until the other
things are wrapped up.

And #5 is certainly a falacy… however, even if they don’t really
need performance, users often think they do, and so bragging rights
would do an amazing amount to bring people over to ruby. Stupid but
true. Another point here is, the bigger ruby sites need to be fast as
well. I know that the ruby-talk archive seems a little pookey, and
people can and will conclude that this means “ruby blows”. While
php.net does go down disturbingly often with that lovely php error
message, when it’s up, it is fast. People base their opinions on such
silly things.

Ruby is so great that if people move towards addressing some of these
things, it’s sure to gain users. I haven’t used ruby in 2 years, and
the other day it literally took me 2 minutes of browsing “the book” to
remeber everything I needed to write prettymuch anything I should
want. That’s awsome.

In general, if Ruby could combine the power of Java Servlets with the
initial learning ease of PHP, with performance joe user would respect,
then it would be the killer web language.

Ohh, and thanks for the tip; always looking for good mexican food in
ptown :).

Anyway, happy Cinco de Mayo! :wink:

Yes, happy Cinco de Mayo! Cinco de Mayo isn’t really Mexican Independence
day as is commonly thought (that’s September 12th) but it marks a victory

Actually The Mexican Independence is on September 15th.

of the Mexican forces against the French in which the Mexican forces were
heavily outnumbered by the better trained and equiped French army.

You know more than many Mexicans !!!

So
sometimes the underdog does win, that should give us hope :wink:

BTW: it’s amazing that what amounts to a fairly minor holiday in Mexico
is a five day celebration here in Portland, OR - any excuse for a party, I
guess. The 4th of July isn’t even celebrated for five days.

It does not happen here in Mexico actually I am working today, just kids
took the day off.
I dont know why this date is more important in the other side of the
river than here ??

Phil

A Mexican underdog working on May 5 … which hates Taco bell and PHP.

Viva Ruby !!

-r.

Which hints to the other reason PHP is so popular: Marketing and cost.
Why
is Taco Bell more popular than El Palenque (on SE 17th; check it out,
Phil)?

I’ll check it out… SE 17th and what’s the cross street?

···

----- Original Message -----
From: “Phil Tomson” ptkwt@shell1.aracnet.com

A few blocks south of Tacoma. Try the plantain w/ mole for dessert!


Taco Bell doesn’t have to be good. It just has to be OK, cheap, and easy.

and the fact that it’s readily available doeesn’t hurt either.

That fits under the “easy” category, I think.


Now to really stretch the analogy: Baja Fresh probably
employs a lot more people than El Palenque. That doesn’t make one better
or worse than the other, but do you see where I’m going?

Absolutely, and that’s an excellent point: in this analogy, are we looking
for a good tamale or a job? Customer or employee? In programming, I guess
we are often both… but, as you pointed out, that’s really where my analogy
breaks down.


Maybe, but PHP started out just like Ruby did, no? It was a free/open
source language. As far as marketing goes, I don’t think they had any
corporate funding for marketing, did they?

Well, I meant marketing in a rather loose way: who was their target
audience, and how were they pitching the “essence” of PHP? A: It was a web
language for web people. The success of this hinged upon the fact that they
were targetting people who weren’t programmers, IMHO. I don’t think it’s
something we could emulate.


BTW: it’s amazing that what amounts to a fairly minor holiday in Mexico
is a five day celebration here in Portland, OR - any excuse for a party, I
guess. The 4th of July isn’t even celebrated for five days.

It’s all about the margaritas, tequila, and Negra Modelo! I’ll tell you,
it’s hurting having a pregnant wife during Cinco de Mayo… no drinking in
the Pine house, I’m afraid.

Chris

A wishlsit for a “Ruby Standard Library”:

  • REXML
  • Ruby-Mysql
  • Ruby-Postgres
  • DBI
  • A graphics manipulation library
  • A vector manipulation library? Something for both maths folk and
    graphics folk?
  • an efficient and modular HTML (and XML?) output toolkit
  • A GUI toolkit, or at least a standard abstract interface to it/them
    • FXRuby?
    • Ruby-GTK?
    • Ruby-GNOME?
    • RIGS?
    • Something glade-based for abstract?

I haven’t checked to see how easy this would be yet, but I was thinking
that making the ObjectiveC-to-Ruby bridge functionality of RIGS a
standard inclusion in the Ruby language would be very powerful:

  • It would allow extensions to be written in an object-oriented C
    language that has a huge and (now that Apple has released OS X)
    rapidly growing developer base and professional toolset.
  • It has a quick migration path for code that needs to be fast:
    Methods can be migrated to ObjC as the need for speed rises.
  • It’s simple and elegant – the code for RIGS is pretty small.
  • It would allow GNUStep, OpenStep, MacOS X and Ruby programmers to
    collaborate naturally, and it would give Ruby a high-profile
    "something it does well" – scripting in a highly object-oriented
    user-interface environment.
  • It would facilitate embedding Ruby in large applications, I think,
    at least for applications that use the GNU toolchain.

I’m sure there’s other benefits, but that is what comes to mind
immediately. GNUStep is getting a big push from the OS X wave, and I
think Ruby could ride that as well – and if either Ruby or GNUStep hit
the point of being highly visible like PHP, MySQL, GNOME, GTK or GIMP
have been, the other projects closely attached would vault very high
indeed.

(As a parallel: GTK was nonexistant in 1995; in 1997-98, GIMP was
released, and gained widespread notoriety as Linux was becoming known,
and as a free alternative to a major app of the time – Photoshop.
Because of the boom, the free desktop project that adopted GTK also got
major notoriety – GNOME. Look at where GNOME is today and see that it
worked. I’m not saying it was intentional, but it happened…)

At the moment, GNOME, GNUStep and KDE all lack a scripting language that
can help tie them together the way AppleScript works on OS X and more.
I can see Ruby filling that niche very nicely. Having a general purpose
language in there means that people learning GUI scripting can move on
to actual app development and other kinds of programming with ease.
Having scripts hanging around one’s GUI is a sure way to lower the
learning curve, too. Starting with GNUStep might be the way to go, just
because the API is so nice, the code exists (RIGS and RubyCocoa), and
because once one GUI system has been nicely tackled, one can then work
on porting the ideas to another.

Anyway, just something to ponder.

Ari

That’s an easy bandwagon to jump on, and (though you may be an exception),
I’d guess that the majority of people who would be willing to throw out
a remark like that couldn’t name more than a couple of such exploits
without looking them up.

I’ll also hazard a guess that should Ruby come to achieve a presence on
the Web even close to what PHP has achieved, we’ll see quite a few
Ruby-related security problems as well. As web-related modules are
developed and used, people will find flaws in them.

I’m not arguing for PHP or against Ruby, by the way. I just think
the perceived web-security difference between PHP and Ruby is likely
largely a reflection of how much each language is used on the web.

···

At 6:01 +0900 5/6/03, Andreas Schwarz wrote:

Aredridel wrote:

On Tue, May 06, 2003 at 12:42:04AM +0900, Lothar Scholz wrote:

  1. PHP was designed to do one job and is great with this. Ruby is a
    general purpose language, that is good in a lot of places and
    unperfect in all.

PHP is also buggier than a swamp in the midwest US.

Oh yes, that’s true. I once tried to use non-blocking sockets… they
should be called non-working sockets, because they didn’t work in both
the windows and the linux version.

PHP was less designed than just kludged together.

The language itself is VERY ugly, this doesn’t need a discussion, and
you could fill a book with the history of security problems in PHP.

If you’re going to make statements like that, you must expect to be
called on it. Specifically: What is your evidence that 50% of MySQL
could be removed by recoding using OO? What’s the level of your
actual familiarity with the MySQL source code?

···

At 21:22 +0900 5/6/03, Lothar Scholz wrote:

  1. Rubies OO functionallity is not so important in CGI like scripts
    (this means scripts that start with no internal variables other
    then session variables).
    This would only be an important point if you use an application
    server, but there is none.

Why would a CGI application benefit less from OO than other types of
applications?

Because a CGI script (or better any non application server like
script) starts with zero data. It loads all data, processes them and
outputs the data. With this constellation there is often not much to do
so no need for a technical better solution.

Okay if you refer to monster applications (for PHP) like PHPNuke or
MySQL then you find that they could be written in 50% of the code when
using good OO. But there are so less applications of this size
(written - not used) that they don’t count for PHP popularity.