About the Author

Chris Shiflett

Chris Shiflett is an author and speaker who leads the web application security practice at OmniTI.


Six Reasons PHP Sucks

Theo has posted the slides of his PHP lightning talk in PDF format. The topic? Why PHP sucks.

I've never disputed the fact that PHP has problems, but for some reason, everyone who tries to explain why PHP sucks misses most of the actual reasons it does. It's astonishing.

Theo doesn't give six reasons I agree with (one or two are there for comic relief), but he starts off with three solid points. More importantly, he notes that Java sucks more, but he can't cover that in five minutes. :-)

About This Post

Six Reasons PHP Sucks was posted on Thu, 03 Aug 2006 at 18:17:24 GMT.

25 Comments

1. Travis's GravatarTravis said:

Chris,

The link (http://omniti.com/~jesus/misc/PHP%20Sucks.swf) is throwing a 404...

Thu, 03 Aug 2006 at 18:55:19 GMT Link


2. Chris Shiflett's GravatarChris Shiflett said:

Thanks, Travis. I'm bugging Theo now. :-)

(It worked earlier.)

Thu, 03 Aug 2006 at 18:56:40 GMT Link


3. jordi's Gravatarjordi said:

One of the most annoying things in PHP is PHP's fastCgi support.

besides fcgi support i don't have any other complain

Thu, 03 Aug 2006 at 19:07:32 GMT Link


4. Chris Shiflett's GravatarChris Shiflett said:

The link has been fixed.

Thu, 03 Aug 2006 at 19:19:48 GMT Link


5. Tim's GravatarTim said:

I completely agree with lexically scoped variables and namespaces. Seriously. We need those.

My number 1 reason that I wouldn't use PHP (or perl) in a heavy load environment is the lack of database connection pooling. 1 connection per Apache thread? That's insane. That's the one place Java will always beat PHP (or perl).

Thu, 03 Aug 2006 at 21:53:46 GMT Link


6. terry chay's Gravatarterry chay said:

http://terrychay.com/blog/article/php-sucks.shtml

Fri, 04 Aug 2006 at 00:36:35 GMT Link


7. Luke Welling's GravatarLuke Welling said:

It must be "We Love Java Week".

Is it celebrated at the same time every year?

Fri, 04 Aug 2006 at 10:43:03 GMT Link


8. Jack's GravatarJack said:

last reason:

Java sucks more, but he can't cover that in five minutes.

can be rewriten:

Flash sucks even more and more and you could cover that in fist minute you start it!

Fri, 04 Aug 2006 at 13:48:37 GMT Link


9. Mutant's GravatarMutant said:

This reads like a 5 year old. Has he ever considered making a cogent point with anything resembling intellect?

Fri, 04 Aug 2006 at 14:36:06 GMT Link


10. funkatron's Gravatarfunkatron said:

I enjoyed Theo's talk a lot, but I did think the shot at PEAR was beyond exaggeration for humor's sake and into the realm of unfounded criticism. The PEAR code I've used -- and I don't use a ton, but what I do use I use a *lot* -- seems pretty good to me, and certainly far above the level of stuff at phpclasses.org or the user-contributed notes in the php.net docs.

Fri, 04 Aug 2006 at 15:08:38 GMT Link


11. terry chay's Gravatarterry chay said:

Luke, I thought it is separated any week of the year you’re not actually trying to get any work done.

Mutant, The idea is to be able to laugh at the deficiencies in your own language.

I wonder if it were PHP5 weren’t out and I said that PHP objects were the most braindead implementation I had ever seen if I’d have been considered over-the-top?

So it is with issues like namespacing, the horrible code examples in the PHP documentation, and the politics that often decided what PEAR library gets in…

Ed, think of it this way, in CPAN almost anyone can put anything in there is code of a lot of variety. In PEAR, only the “good stuff” is supposed to get in (because of no namespacing), and then you look at it. Sure it beats a lot of code snippets you see out there, but then you look at it and say, “This is the good stuff???”

A shiver passes down your spine as you realize that there must be some pretty bad “bad stuff” out there to warrant this library passing the crazy crap politics that is PEAR.

Fri, 04 Aug 2006 at 19:59:58 GMT Link


12. funkatron's Gravatarfunkatron said:

"A shiver passes down your spine as you realize that there must be some pretty bad “bad stuff” out there to warrant this library passing the crazy crap politics that is PEAR."

Shit, you know that, though. This is PHP: the power to heal, the power to kill, in the hands of a dork.

But I stand by my statement that there are some very well-done libraries in PEAR, and for quite a while it was the first and best place to look for solid components to build your web apps on. That situation has changed quite a bit in the past 2-3 years, though, but it's not like PEAR is suddenly a turd floating in the bowl of PHP development.

Fri, 04 Aug 2006 at 20:19:41 GMT Link


13. Ben Ramsey's GravatarBen Ramsey said:

"but it's not like PEAR is suddenly a turd floating in the bowl of PHP development"

What an awesome simile!

Fri, 04 Aug 2006 at 20:44:22 GMT Link


14. Luke Welling's GravatarLuke Welling said:

I feel like I should defend the user comments in the manual too. They might have passed their prime somewhat, but once upon a time, the PHP docs had more gaps, did not tell you what version a function was added in, and did not mention that a function was completely broken on some versions. Back then, the user comments were invaluable.

The quality of the official docs is now much better, so I am sure that they are less valuable, but I imagine if you went into some of the fringe libraries, the comments might be as useful as the official text sometimes.

Of course, like any free for all systems, it is basically a big vat of floating turds and it is up to you to pluck the goldfish out from between them.

Sat, 05 Aug 2006 at 00:32:45 GMT Link


15. Aaron's GravatarAaron said:

User comments are user comments :) anyone who takes them seriously has issues. I always scan over them when looking at the documentation and often find interesting snippets.

A lot of crap in the mysql comments as well, but they really add a lot there as well.

Tue, 08 Aug 2006 at 17:16:30 GMT Link


16. Chris Shiflett's GravatarChris Shiflett said:

Yeah, I think the user comments have value as well. That's one of the points where I disagree with Theo, but it was nice to see someone voicing a few legitimate complaints.

Theo's talk was given with the same sort of humor and style as Rich's from a few ApacheCons ago:

http://people.apache.org/~rbowen/pr...hate_apache.pdf

Tue, 08 Aug 2006 at 17:30:30 GMT Link


17. Chris Shiflett's GravatarChris Shiflett said:

Andy Lester has a great explanation of why CPAN thrives:

"CPAN thrives because of the unfettered uploading of shit, not in spite of it."

(http://use.perl.org/~petdance/journal/29837)

I think there are plenty of good things to say about PEAR, but far too many people mention the word politics when talking about getting a package accepted. Why is this?

Perhaps it's just the cool thing to say, but there must be some truth to it. Would it ruin PEAR to allow "unfettered uploading of shit" instead of trying to maintain strict standards? CPAN has shown us that people tend to use the good stuff anyway.

Just a thought.

Tue, 08 Aug 2006 at 17:41:05 GMT Link


18. Aaron's GravatarAaron said:

(I hate to say this but...) The difference is that Rich's issues is that they are issues which come "from the trenches". Rich spends a LOT of time in IRC, he's help us all out, I have his book on my shelf, and he is very well known for his effort in supporting the Apache community.

What has Theo done to help PEAR or bring the quality level of PHP manual comments up? There's a difference in being self-deprecating and trashing something that others work hard on.

Wed, 09 Aug 2006 at 13:28:43 GMT Link


19. terry chay's Gravatarterry chay said:

Chris, I believe the restriction on PEAR (the politics) comes from the lack of namespacing in PHP. This means that it should be important to revisit the problem after PHP6.

The idea is the lack of namespacing, like with any large PHP installation, is going to cause conflicts because the only thing keeping your libraries sane is a naming convention that you tightly control. This is one of the major weaknesses of a scopeless paradigm of PHP (which caused the lack of namespacing).

In any case, Greg Beaver and others found a great way around some of this crap. The addition of channel subscriptions. It solves the problem of the politics, but makes PEAR very fragmented (at least if your stuff is languishing in an obscure channel somewhere).

It may seem like Theo’s rant is “trashing” but it really isn’t. These were honest design decisions that led PHP in a different direction than other languages. I think we have only to point to PHP’s huge marketshare to know that in many ways, these design decisions were good (or at least, not terribly bad).

User comments, the PEAR library, lack of namespacing, lack of lexical scoping. These are all the strength of PHP.

But sometimes it is fun to poke at when they can be a weakness.

Fri, 11 Aug 2006 at 17:29:01 GMT Link


20. James Benson's GravatarJames Benson said:

What a load of crap. I see their is no mention of Inconsistant function names, this is definitely my worst complaint about PHP, other than that it does exactly what it says on the tin.

Fri, 11 Aug 2006 at 20:23:37 GMT Link


21. Chris Shiflett's GravatarChris Shiflett said:

I don't see inconsistent function names as a problem. It's like criticizing a professional athlete for having an ugly nose.

George comments a bit on this in his recent interview:

http://devzone.zend.com/node/view/id/799

Fri, 11 Aug 2006 at 20:26:33 GMT Link


22. James Benson's GravatarJames Benson said:

Your right it probably aint a problem for people who know PHP and have been using it day to day but for new comers to the language I would say it is a major problem, I remember having this problem myself when beginning.

Wed, 16 Aug 2006 at 11:09:35 GMT Link


23. web programmer's Gravatarweb programmer said:

who needs a rational language design when it comes to working on the web?

Coming from Java and dotNet, I embraced PHP's non-language flat style and actually started getting stuff accomplished.

All you need to do on the web is there in the flat library of functions and hashtables, and the superglobals.

Anybody who tells you you need a rationalized overengineered computing language to do this stuff should be programming guidance systems for lunar rovers instead of putting up a web site.

I am not missing lexical scoping and never use objects except when the utilities force me to.

Mon, 21 Aug 2006 at 14:12:38 GMT Link


24. joe's Gravatarjoe said:

Was there a famous quote something along the lines of:

"There is software that people bitch about, and software that no one uses." ?

Another mild irritant is the mandatory "$this->" but there could be (inelegant but) handy workarounds.

My 2 cents.

Wed, 23 Aug 2006 at 14:11:37 GMT Link


25. Alan's GravatarAlan said:

How about the fact that I have to hit shift 2x to access an object property? RSI, people.

Wed, 19 Sep 2007 at 03:26:55 GMT Link


Post A Comment

Personal Details and Comment

Style Guide

Line breaks are converted to paragraphs. Also use:

  • <a href="" title="">text</a>1
  • <em>text</em>
  • <blockquote><p>text</p></blockquote>
  • <code>2  <?php  if ($foo) {      $foo = TRUE;  }  ?></code>
  1. Note: <code> can be used inline (e.g. in paragraphs) or in a block as shown. Include whitespace and newlines in blocks.

Please enter Chris (my first name) below. This is a primitive spam prevention technique, and I apologize for the inconvenience.

Preview and Submit

Upcoming Talks

O'Reilly Open Source Convention

21 - 25 Jul 2008

At Oregon Convention Center, Portland, Oregon.

ZendCon

15 - 18 Sep 2008

In Santa Clara, California.

PHP Appalachia

11 - 14 Oct 2008

At Big Bear Lodge, Gatlinburg, Tennessee.

New Comments

Amir wrote:

Hi chris! Please check this and guide me: http://forums.devnetwork.net/viewtopic.php?f=34&t=8...

Posted in
Nathan Bentley wrote:

Hi Chris, A great tutorial, which should help a lot of people! We implemented something simil...

Posted in
Daniel S wrote:

Just recently I sold my 1.gen Macbook(core duo version). And to be honest, I don't miss it for on...

Posted in Top X List of Mac OS X Annoyances
Buke Beyond wrote:

I agree it is ridiculous that php is doing this. I am using php for generating commands for othe...

Posted in PHP Stripping Newlines
Davis Ford wrote:

I agree, although I have a list of many more annoyances. However, rather than complain about the...

Posted in Top X List of Mac OS X Annoyances

Browse Comments