
The True Problem With PHP - ircmaxell
http://blog.ircmaxell.com/2012/07/true-problem-with-php.html
======
randomdrake
I find it surprising that no one has mentioned, what I consider to be, the
best source of information and help with the PHP language out there.

The ##php IRC channel on freenode (1) is an absolutely incredible resource.
I've idled in there for many years now and the amount of good, relevant, and
accurate information that can be obtained in there is incredible. Whether you
have been programming for 5 days or 5 years, simply hanging out in the channel
for a couple of days can offer insights and tricks that you may have never
known about.

Over time, the folks there have compiled an absolutely excellent Wiki (2) for
developers; old and new. In addition, there is a wonderful list of general
do's and don'ts for PHP application development. (3)

Time and time again, we get folks in there who are using outdated technologies
(hello mysql_* functions) or just awful tutorials or resources and they get
turned around in no time.

Disclaimer: as the author states, there are many self-described experts in PHP
and they do, occasionally offer bad advice. However, it is rare for the bad
advice to go unchecked in this IRC channel so I can still recommend it without
worry.

[1] - <http://freenode.net/>

[2] - <http://wiki.hashphp.org/Main_Page>

[3] - <http://hashphp.org/>

~~~
sopooneo
This may be deeply stupid, but I'm new to IRC, and I'm getting a message on
Freenode saying "Cannot join #php (Channel is invite only)". Am I missing
something? Or is it possible to just watch the discussion without
participating and that doesn't require an invite?

~~~
yoklov
Freenode uses ##<channel> to refer to "non-primary" channels. Regardless of
what that means (I don't really know), the channel you're looking for is
##php.

------
PaulHoule
Uh, I haven't seen PHP-ers go to conventions with pornographic slide decks,
unlike some users of some more fashionable language.

There are some real problems in the PHP community, like the terrible mismatch
between the PHP core and PEAR developers, and the fact that nobody's got the
guts to declare PEAR a failure, put it down, and start something new. However,
other than that, the people I know involved with PHP are reasonable people.

For me the trouble w/ PHP is that it works too well.

I've got a small project w/ 40 hours budgeted for it, 20 of those are software
dev, and 20 are corporate identity and marketing.

I have libraries that smooth over the worst flaws of PHP and answers to error
handling, sysadmin, and all that. I know the odds are very good I can slap
this thing onto one of my production servers, push the 'go' button, and have
it work for 2 or 3 years before I need to look at it again.

Ruby may be nicer, and Java is better for computationally complex and
intensive stuff (not this) but adding a new language to the mix probably means
more hosting costs (maybe abother $60-120 a month) and probably turns that 20
hours to 60. It will take me a long time to have faith in the stability of
another hosting system too.

The reality is I nail out quite a few of these mini projects, some of which
succeed, and many of which just smoulder. With PHP I can get them done quick
and done well and have low hosting costs and little maintenance burden.

To get me to switch you need to quit complaining about the faults of PHP and
build my faith that your hosting system is a 'wooden round' that won't cause
my 20-hour project to cost me 50+ hours a year in maintenance costs.

~~~
debacle
> nobody's got the guts to declare PEAR a failure, put it down, and start
> something new.

<https://github.com/composer/composer>

~~~
ericras
What's the difference between composer and PEAR2/Pyrus?
(<http://pear2.php.net/>)

~~~
debacle
I trust the companies and individuals behind Composer to not fuck shit up.

------
uzyn
Some of the experienced PHP developers have recently started a PHP mentoring
program with the aim of helping beginners and intermediate PHP developers.
Info: <http://phpmentoring.org/>

If you're interested in mentoring or being mentored, add yourself to the list.
[https://github.com/phpmentoring/phpmentoring.github.com/wiki...](https://github.com/phpmentoring/phpmentoring.github.com/wiki/Mentors-
and-Apprentices)

The program has only been initialized 4 days ago and it has gotten quite a bit
of interest.

Freenode: #phpmentoring

~~~
wyclif
Thank you, this is the most useful comment in this thread. Signing up.

------
Jabbles
Perhaps you can learn from the Perl community's experience as they realised
they had the same problem less than a year ago?

[http://blogs.perl.org/users/mithaldu/2011/10/perl-
tutorials-...](http://blogs.perl.org/users/mithaldu/2011/10/perl-tutorials-
suck-and-cause-serious-damage.html)

<http://news.ycombinator.com/item?id=3158276>

~~~
hsmyers
They have known and been doing things about bad Perl advice for a lot longer
than a year. There have been idiots who have made reputations based on some of
the worst possible code you can imagine and it has taken a lot of time to
convince newcomers that they should read and ask questions else where. The
good news is that the communities like PerlMonks do an excellent job of good
advice (occasionally with really good flame wars :) ), the trouble being that
it may take a little bit of luck for the beginner to stumble across the
resource.

------
Kilimanjaro
Who wants to be the Jeremy Ashkenas of PHP?

There, a perfect opportunity for language designers to shine. Nothing fancy,
just fork and fix. No need to come up with new paradigms. Nothing to make you
sweat. Just fork the damn thing and fix the warts with a scalpel.

It is and will be the most used language for web development. If that is not a
shiny medal in your chest and a place in history books, I don't know what is.

Any takers?

~~~
Kilimanjaro
Some things I'd like to fix:

    
    
        Drop the dollar
        Use + for str concat
        Use . for class members
        Use . for dicts 
        Use . for namespaces
        Use : for key:value pairs
        Fix needles and haystacks
        Use camelCase for functions
        Use arrays and dicts literals
        Use list genereators
        Use request and response objects
        Objectify strings, lists and dicts
    

While most of it is syntactic sugar, this will solve 90% of the problems for
90% of the people.

Feel free to add yours.

~~~
kbanman
So, basically make it javascript. I'm a long-time PHP developer, but I'd very
much like that. Someday I'll have to learn node.js...

~~~
kree10
That's the thing. Once you have "fixed" PHP, you're left with a brand new
language that few people know, won't run your existing code, isn't included in
Linux distributions or hosting packages, have no books about it and no answers
on StackOverflow.

Of course these things will all happen in time if the fixed version takes
hold. But if you're willing to throw out PHP and start anew, you can have all
of the above _right now_ by learning Node, Rails, Django, etc.

I think the comment above about needing a Jeremy Ashkenas (that is, a
CoffeeScript for PHP) is the only realistic way for a "fixed" PHP to succeed.
There needs to be a smooth transition, and a FixedPHP-to-PHP5 compiler could
provide it.

------
mootothemax
People telling you to do the wrong thing is undoubtedly a large problem. For
example, one of the things I don't like about the CakePHP framework is the
advice you find when searching for seemingly simple questions, like how to use
the database's current timestamp with Cake's ORM.

You typically see one of two responses - either call one of your columns
"modified" or "created" and hack it in like that. Or, use PHP's built-in
date() function, ignoring the issues that brings (e.g. the current timezone
could be _anything_ \- not always what the database is operating under).

This is an ongoing problem, and is likely related to PHP's ease-of-use; for
new users, it's easy to get a sense that you know more than you think you do,
and give advice accordingly.

The bigger problem is that it keeps building upon itself. People who don't
know better, taking advice at face value, then giving that advice increases
the number of people writing crap code. Try searching for password storing
advice, and you'll see masses of varients of md5('salty_' . $password);

~~~
teresko
Well .. if you are looking for high quality code, anywhere related to CakePHP
is the wrong place.

~~~
mootothemax
_Well .. if you are looking for high quality code, anywhere related to CakePHP
is the wrong place._

Hehe, that's might be related to why I wrote _one of the things_ and not the
_only_ thing ;-)

------
larrik
The TRUE problem with PHP is that you can prototype extremely fast in it, and
then you are stuck in PHP. Django and the like have a lot of setup time to
really get started, even if after a few hours into it you're already saving
time compared to PHP.

I've found it hard to argue against PHP with my former bosses, due to this
fact.

~~~
gee_totes
Alas, the rapid prototyping is a trap I fall into all the time. Spinning up an
ol' Symfony 1.4 application to mock-up a REST API so I have something to build
a Backbone.js app against is the practice that keeps leaving me tethered to
PHP.

If there were something that would allow me to spin up local application and
work with my existing, already running Apache processes, I could move away
from PHP.

~~~
cheald
Sinatra is pretty great for rapid prototyping. For example:
<https://gist.github.com/3062572>

Then I just invoke it with "shotgun rest.rb" and hit <http://localhost:9393/>
and I'm up and running. It's not running through Apache, but it's not really
significantly more difficult than PHP prototyping.

    
    
        curl -d "foo[bar]=1&foo[baz]=hello%20there" http://localhost:9393/foos
        {"result":"success"}
    
        curl http://localhost:9393/foos/1
        {"bar":"1","baz":"hello there","id":"1"}
    

Easy peasy.

~~~
gee_totes
Agreed, actually. I learned I can stand up Sintra and not bork my local apache
instance, and now I'm hooked. Thanks!

------
rlx0x
sure THATS the problem with PHP, it has absolutely nothing to do with the
horrible language design [1] and the dickhead [2] core developers.

[1] [http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-
de...](http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/)

[2] <https://bugs.php.net/bug.php?id=50696>
<https://bugs.php.net/bug.php?id=18556>

~~~
ericingram
It's one problem and those are two more, but I would argue these problems look
minor compared to the obstacles standing in front of some other languages.

It seems the HN community tends to over-value language design and under-value
low barriers to adoption.

~~~
LnxPrgr3
If I'm picking a language for a new project, I don't care about barriers to
adoption, as long as they're low enough that I and anyone else I'm trying to
work with can get through them. I do care about the language having at least
something vaguely resembling reasonable behavior.

Why would I optimize for barriers to adoption? I don't need my language of
choice to be popular to get away with using it, _especially_ if I'm building
one of those Web thingers everyone likes to make these days.

What I do need is a language I can be productive in. All else being equal, the
less a language surprises me with inconsistent or outright broken behavior,
the more productive I can be with it.

From <http://www.paulgraham.com/avg.html>:

"Robert and I both knew Lisp well, and we couldn't see any reason not to trust
our instincts and go with Lisp. We knew that everyone else was writing their
software in C++ or Perl. But we also knew that that didn't mean anything. If
you chose technology that way, you'd be running Windows. When you choose
technology, you have to ignore what other people are doing, and consider only
what will work the best."

So, yes: I can't speak for everyone, but I would rather use a well designed
language with poor adoption than a poorly designed language that's been widely
adopted.

------
jere
Wow, I had no idea w3schools was so inaccurate. I turn to it all the time for
a quick reference. I suppose I'd be classified as one of the lunatic fringe if
I was actually writing tutorials. <http://w3fools.com/>

------
Kilimanjaro
While stupid people keep using blinking tags and lolcats, and while astronauts
keep thinking about concurrency and monads, php will grow stronger than ever.

Astronauts need to come down to earth and help stupid people build better
blinking tags for their lolcats, not push them to write lolcats in monads with
concurrency.

So, whether astronauts like it or not, a simpler un-evented node.js would sell
like hotcakes (because it is js, not because it is evented), while a cleaner,
facelifted php will sell even more.

Fork php, use + for string concatenating, . for class members, fix haystacks
and needles, add [1,2,3] and {a:1,b:2} as simple data structs, that's all
lolcats need.

Learn to serve your customers, even if they are stupid.

~~~
mootothemax
It's not very nice to refer to people as being stupid for wanting to use PHP,
or likewise for those who code in PHP themselves.

My Erlang isn't bad, but it would be _madness_ for me to suggest it to a
client. What happens if I get run over by a bus tomorrow, or we need to bring
extra coders on board?

Erlang, for all its many, many favours, is just not appropriate for the
average-client-on-the-street.

I realise that you didn't use Erlang as an example, but there's a reason why
there's so much work for competent PHP programmers, and it's not stupidity.

~~~
agumonkey
Your leave of absence causes demand for Erlang programmers which triggers
interest to teach it and a flod of workforce. No more $blub. Hopefully.

~~~
andrewflnr
One headless Erlang project is going to cause a flood of interest in Erlang?
You have a lot more hope than I do.

------
LnxPrgr3
This is definitely a problem, and not just for PHP. Check out this section
from a C++ tutorial:
<http://www.functionx.com/cpp/examples/returnpointer.htm>. The author is very
clearly confused by even the basic rules of C++, yet he's out there trying to
teach others. It's the blind leading the blind.

(Incidentally, I found it again by Googling for "worst C++ tutorial"—for me,
it was the first match.)

So yes, someone, please do throw some good advice out there to help drown out
the bad!

------
xd
I'm getting tired of these posts, but he brings up a good point.

You only have to browse code on phpclasses.org (the most popular PHP code
contribution site I think?) to see that there is something very very wrong
with how PHP code is developed.

Also the comments left in the PHP documentation don't seem to be moderated on
code quality and a lot of bad practice has slipped in.

~~~
melicerte
That just means that there are bad programmers outside, not necessarily bad
languages. Nevertheless, I don't know a single perfect programming language
anyway, so you can write tons of article titled "what's wrong with xxx". But,
apart driving a lot of readers to your blog, these posts do not help at all.

~~~
xd
I think I've been miss understood. My point wasn't that PHP is a bad language,
I'm a hardened PHP dev and have been fighting it's corner here on HN for
months.

It really doesn't help PHP that a site as popular as phpclasses has such a
large degree of inferior code.

------
mildweed
I propose this wiki content reside on <https://wiki.php.net/>

Sure, the page self-declares that it is "mainly used to track internal
development of the PHP project", but its a wiki. We can change that.

------
chrisblackwell
If everyone spent as much time promoting alternative languages, as they did
bashing PHP, then Python would have been the most popular language 3 years
ago!

~~~
agumonkey
And/Or setup tons of cheap and easy hosting services. PHP bashing has jumped
the shark.

~~~
slurgfest
There is really no money in $2/mo shared hosting, is there? I don't think it
is a very interesting problem, either.

In 2012, the availability of hosting and ease of deploy is no longer a reason
not to use Ruby, Python, or whatever.

------
crisnoble
>But on the fringes, there are a lot of people who are writing articles,
tutorials, and posts designed to help beginners learn the language (and
usually how to program). The problem with this is that the majority of those
authors frankly don't have a clue what they are talking about

Where would one find a _good_ tutorial site?

~~~
rada
<http://us.php.net/manual/en/>

------
Sumaso
The True Problem With PHP is that there are too many people complaining about
PHP.

Its been said before, and I'll say it again: if you dont like PHP switch to
something better, if there isn't anything better make something better.

------
gm
Bah. I was expecting more insight than "It's the people at the fringes".

The problem with _anything_ big enough to have a fringe is always the people
at the fringes.

------
clown
Argue all you want, but all this PHP bashing isn't solving anything, it's just
dividing the coding community.

I'm going to get back to work and continue coding in my chosen tool, PHP, see
you all at the finish line because whatever your tool, we'll all get there in
the end.

~~~
zenogais
These kinds of comments baffle me. Discussion and critical analysis of your
tools is a great thing in my opinion. Work isn't everything.

~~~
clown
Was just commenting on how I'm currently using it, feel free to replace work
with anything you like. I guess like you, I'm baffled too, as comments like
"Work isn't everything" baffle me as it's based entirely on assumption and
failure to see beyond your scope of understanding.

Whilst I agree critical analysis is great, general discussion can be somewhat
impressionable on newcomers. Whether you realize it or not, PHP bashing / over
praising will been seen by newcomers and they won't know where the foundation
lies.

Why must we push ideas and concepts onto people, why can't we give our points
and let people make up their own mind. Personally I don't want to drift
through life with people telling me what to use or what not to use, I'd prefer
to see the points and make up my own mind without being preached to.

------
soc88
> The core of the PHP community is filled with a lot of really talented and
> smart developers doing some really amazing things.

Like those, who failed for years to actually consult the results of the test
suite before shipping a new release?
<http://gcov.php.net/viewer.php?version=PHP_5_4>

Like those who change stuff incompatibly to the worse, while introducing
security holes? <http://php.net/manual/en/function.is-a.php>
<https://bugs.php.net/bug.php?id=55475>

Like those were security fixes create even larger holes?
[http://thexploit.com/secdev/critical-php-remote-
vulnerabilit...](http://thexploit.com/secdev/critical-php-remote-
vulnerability-introduced-in-fix-for-php-hashtable-collision-dos/)

Like those who can't program a sane line of code in the language PHP is
written in? "OMG, this calculation overflows, let's replace the int by an
float!"

You can't make that shit up. I have nothing against stupid people, but against
stupid people who fight against every kind of process who could prevent their
own stupidity like

\- "learning from mistakes",

\- "learning the language they actually program in",

\- "handling bug reports in a way it doesn't alienate reporters" or

\- "having a decent test coverage".

Instead of thinking about yet-another-documentation site, what about fixing
the devastating quality of their API documentation (especially the comments)?

~~~
LnxPrgr3
Still my favorite PHP bug story:
[http://use.perl.org/use.perl.org/_Aristotle/journal/33448.ht...](http://use.perl.org/use.perl.org/_Aristotle/journal/33448.html)

Though this one isn't far off: <https://bugs.php.net/bug.php?id=18556>.

~~~
cdcarter
Wait wait, this Turkish bug is just under TEN YEARS OLD?

~~~
LnxPrgr3
To be fair, it looks like it was fixed for a while, before resurfacing in 2006
and being ignored for the next 6 years.

------
its_so_on
In other words:

 _The problem with English is that most of the people speaking it, writing it,
or teaching it - collectively what I shall call the 'fringe' - could not so
much as pen a tolerable introduction to a Penguin Classics paperback._

This is 2012, people. Programming isn't just a profession, it's an everyday
skill that everyone should learn, regardless of how badly. PHP is a great
enabler for this - and I endorse this direction completely.

~~~
henryboston
Why do you believe everyone should learn programming?

~~~
its_so_on
This is not flippant, but if you think about it, it's what separates us from
animals.

~~~
meepmorp
The only thing that separates us from other animals is a persistent desire to
separate ourselves from other animals.

~~~
fauigerzigerk
Exactly, because that is a sign of self consciousness which is what actually
seperates us from other animals ;-)

~~~
meepmorp
Dunno, I've seen some evidence that other animals also have self-
consciousness. Maybe it's the fact that we're uppity about it.

------
virtuz
This is always going to be the case with PHP – it's got the lowest barriers to
entry of any web language, so it's going to have the largest share of bad
coders. It's not a problem; people have to start somewhere and you can't, in
an authoritarian manner, stop people from writing blog posts if they're not
expert.

That said, I don't think it's about this. I think it's about respect. And
people, right now, just don't respect PHP.

~~~
teresko
Why exactly "bad tutorials" always be the problem ? And how is it related to
lowest entry barrier ?

Did you read the article ?

~~~
virtuz
Yeah, did you?

> But on the fringes, there are a lot of people who are writing articles,
> tutorials, and posts designed to help beginners learn the language (and
> usually how to program). The problem with this is that the majority of those
> authors frankly don't have a clue what they are talking about.

It's the most ubiquitous language, which leads to being the easiest to start
with. Thing is, if people learn it wrong they're going to churn out crap.
That's a vicious cycle.

------
timaelliott
Another day, another "Problems with PHP" article. Seems like everyone has to
toss their hat into the ring.

If someone were to write a "Problems with PHP and Proper Password Hashing"
post it would be #1 for weeks!

~~~
conradfr
Seriously, it's the very real hacker news circlejerk.

I would be more interested about an article titled "From Zend Framework to
Django" (or whatever language/framework) than the thousandth article "Your
language is bad and you should feel bad".

~~~
jeltz
Does not sound like you have read the article. The article was not programming
language bashing but bashing of the PHP community by a member of said
community.

------
hastur
The true problem with PHP is that people waste enormous amount of time writing
about what's wrong with PHP. And others - on reading this stuff and voting it
up on news sites so that it occupies precious front page real estate.

Don't like it? Don't use it. Move along.

