PHP is much better than what you think(fabien.potencier.org)
fabien.potencier.org
PHP is much better than what you think
http://fabien.potencier.org/article/64/php-is-much-better-than-what-you-think
334 comments
What would happen if you could put a <?python> tag with python code right in a page just like you do with the <?php> tag? Is this even theoretically possible?
I feel like the biggest advantage PHP and classic ASP have is that there is a low barrier to get the most basic dynamic content working. If you're not a programmer, you don't need to understand a framework or a design pattern to get things going.
I feel like the biggest advantage PHP and classic ASP have is that there is a low barrier to get the most basic dynamic content working. If you're not a programmer, you don't need to understand a framework or a design pattern to get things going.
> PHP is used by 77.9% of all the websites (...) PHP must have done something right, no?
My favorite answer to this is "because millions of lemmings cannot be wrong".
PHP is a horrible language. Like FORTRAN and COBOL. Like BASIC.
Let me be clear about this. It is a horrible language.
Having said that, a good programmer can make good programs even in the most horrible (and I'm deliberately excluding the deliberately horrible ones) language. It is possible to write elegant PHP just like it's possible to write concise Java. All it takes is lots of discipline. Something most programmers, sadly, lack.
PHP is immensely popular and its runtime is incredibly easy to deploy. I sometimes have small fights with Apache to enable some WSGI app (I never remember every detail I have to include in the configuration) but PHP is unusually easy to set up. That probably is a good explanation on why it's so popular on cheap hosting - because it's easy to manage. That also makes it a good choice for quick projects such as hotsites. I prefer to do those on Google's App Engine, but this is a question of taste, not of availability. In all fairness, those sites could be developed in ASP/VBScript and I wouldn't regard that as a mortal offense - they'll live for months under a single release lifecycle. Use whatever gets the job done for less. And programmers without discipline usually cost less.
Much like there are millions of lines of COBOL, FORTRAN and BASIC we'll never get rid of, there are millions of lines of PHP that'll keep running for decades. PHP is a fact of life. I won't be using it for any new projects and would question the sanity of anyone willing to start a long life one with it, but each developer must choose which tools they want to spend their lives with.
My favorite answer to this is "because millions of lemmings cannot be wrong".
PHP is a horrible language. Like FORTRAN and COBOL. Like BASIC.
Let me be clear about this. It is a horrible language.
Having said that, a good programmer can make good programs even in the most horrible (and I'm deliberately excluding the deliberately horrible ones) language. It is possible to write elegant PHP just like it's possible to write concise Java. All it takes is lots of discipline. Something most programmers, sadly, lack.
PHP is immensely popular and its runtime is incredibly easy to deploy. I sometimes have small fights with Apache to enable some WSGI app (I never remember every detail I have to include in the configuration) but PHP is unusually easy to set up. That probably is a good explanation on why it's so popular on cheap hosting - because it's easy to manage. That also makes it a good choice for quick projects such as hotsites. I prefer to do those on Google's App Engine, but this is a question of taste, not of availability. In all fairness, those sites could be developed in ASP/VBScript and I wouldn't regard that as a mortal offense - they'll live for months under a single release lifecycle. Use whatever gets the job done for less. And programmers without discipline usually cost less.
Much like there are millions of lines of COBOL, FORTRAN and BASIC we'll never get rid of, there are millions of lines of PHP that'll keep running for decades. PHP is a fact of life. I won't be using it for any new projects and would question the sanity of anyone willing to start a long life one with it, but each developer must choose which tools they want to spend their lives with.
Well, the reasons I started learning PHP were:
1. It was the most popular web language when I started (in 2000), the alternative being ASP...
2. It's extremely easy to use and set up. Most starting programmers/developpers work on Windows. If you want to start developping on Ruby or Pythons you have two possibilities:
- Install linux, which (whatever you may think) is not easy for any newbie.
- Try to work out the Windows ports of your programming language of choice. In the case of ruby, you have to find windows installs for ruby, gems, bundler, rake, rails (or whatever app you want to use), git, probably cygwin, your webserver of choice, etc... Most of these elements are not made for the Windows ecosystem and the ports are usually pretty poorly documented.
If you use PHP, you just have to: 1. Install XAMPP. 2. Click on "launch server" 3. go to http://localhost/
This is why PHP is still popular.
1. It was the most popular web language when I started (in 2000), the alternative being ASP...
2. It's extremely easy to use and set up. Most starting programmers/developpers work on Windows. If you want to start developping on Ruby or Pythons you have two possibilities:
- Install linux, which (whatever you may think) is not easy for any newbie.
- Try to work out the Windows ports of your programming language of choice. In the case of ruby, you have to find windows installs for ruby, gems, bundler, rake, rails (or whatever app you want to use), git, probably cygwin, your webserver of choice, etc... Most of these elements are not made for the Windows ecosystem and the ports are usually pretty poorly documented.
If you use PHP, you just have to: 1. Install XAMPP. 2. Click on "launch server" 3. go to http://localhost/
This is why PHP is still popular.
As a developer I have great respect for Fabien Potencier and his contributions to the PHP community. Sadly thoguh, I think he's done so in vain. You cannot fix what's infinitely broken.
* PHP may have evolved to support many new methods and features that is expected from a modern language, but mixing and mashing ideas and implementations from other languages in a semingly random fashion doesn't make a language good; only messy. It still and always will lack a proper philosophical design.
* PHP's ecosystem is far from healthy. It's flooded with outdated and/or badly written code, so it really doesn't matter if dependency management is good. Wordpress is proof of this, just look at the source.
* PHP is neither easy to learn or code (correctly). It's just so forgivable that you can do more or less everything wrong and still have a working application. Fabien, you should know this.
* PHP is a resource hog compared to the competition; even with the tiniest stack. I.e. running Node.js will use less then a third of the resources compared to a LAMP stack.
There will never be a "best language" to rule them all. Every situation have different needs. Sure, PHP have filled its purpose during the years, but I'm certain that we've hit peak-PHP. It's the IE of programming languages, and its slow death have already begun.
* PHP may have evolved to support many new methods and features that is expected from a modern language, but mixing and mashing ideas and implementations from other languages in a semingly random fashion doesn't make a language good; only messy. It still and always will lack a proper philosophical design.
* PHP's ecosystem is far from healthy. It's flooded with outdated and/or badly written code, so it really doesn't matter if dependency management is good. Wordpress is proof of this, just look at the source.
* PHP is neither easy to learn or code (correctly). It's just so forgivable that you can do more or less everything wrong and still have a working application. Fabien, you should know this.
* PHP is a resource hog compared to the competition; even with the tiniest stack. I.e. running Node.js will use less then a third of the resources compared to a LAMP stack.
There will never be a "best language" to rule them all. Every situation have different needs. Sure, PHP have filled its purpose during the years, but I'm certain that we've hit peak-PHP. It's the IE of programming languages, and its slow death have already begun.
Don't forget to turn off the Easter eggs when you use your default install of PHP (expose_php = off in php.ini). [1]
1. http://en.wikipedia.org/?=PHPE9568F36-D428-11d2-A769-00AA001...
1. http://en.wikipedia.org/?=PHPE9568F36-D428-11d2-A769-00AA001...
[deleted]
PHP is big because 10 years ago, it was the best choice. Back then, the non-microsoft options were Perl, ColdFusion, Java, and PHP. PHP was the best for web development out of that.
This isn't the case anymore. PHP has been far surpassed by Python and Ruby.
PHP is a wonderful templating language.
Where does my opinion come from? I switch us from PHP to Python after writing a large CMS in PHP.
This isn't the case anymore. PHP has been far surpassed by Python and Ruby.
PHP is a wonderful templating language.
Where does my opinion come from? I switch us from PHP to Python after writing a large CMS in PHP.
Does PHP have a function to generate a new URL that is the current URL with one of the GET parameters changed yet?
After working with PHP for years, I've taken a look at rails and a few python frameworks, and looking back to PHP it makes me sad that I have to keep using a "web oriented language" that doesn't come with basic web features :-(
After working with PHP for years, I've taken a look at rails and a few python frameworks, and looking back to PHP it makes me sad that I have to keep using a "web oriented language" that doesn't come with basic web features :-(
If people who bash about PHP , had used symfony2 framework, they would have changed their mind to some extent..
Composer is pretty nice, but there's at least once vital package that's missing from it: PHPUnit.
As long as the only decent testing framework[1] isn't in the package repository, It just seems somehow not "official" enough.
[1] which still has more than its fair share of legacy warts
As long as the only decent testing framework[1] isn't in the package repository, It just seems somehow not "official" enough.
[1] which still has more than its fair share of legacy warts
From the article:
> PHP is used by 77.9% of all the websites whose server-side programming language is known.
Selection bias. PHP Has a higher tendency to advertise itself.
> PHP is used by 77.9% of all the websites whose server-side programming language is known.
Selection bias. PHP Has a higher tendency to advertise itself.
Do PHP engineers even know what multithreading is?
ps. I don't mean crontab
ps. I don't mean crontab
PHP still can't access email inboxes inherently, can't do CSV import, can't download packages from GitHub the way Bundler can, doesn't support metaprogramming, has a hacked-together OOP system, and has an absolutely horrid syntax.
Why am I meant to use PHP again?
Oh yeah, because you haven't discovered Ruby yet.
Why am I meant to use PHP again?
Oh yeah, because you haven't discovered Ruby yet.
I'd stay away from a language that has function names like array_keys or allows you to write array("a" => "green", "red", "blue");
Composer has been a game changer for me in the last couple of months. Getting setup on a big framework (Symfony2), or even a small framework (Silex) always felt like a bit of a pain.
Great post. The grammar in the post title has a bit to be desired though. "than what"?
[deleted]
"PHP is the best web platform ever", because it (finally) has a decent package manager. And don't mind that far fetched statement, the author will surely delete any rude comments.
Congrats, PHP has a package manager. This does nothing to shake my feeling that PHP's most ardent advocates have little hands-on experience with the more full-featured alternatives. You know, like the ones that also have decent package management without PHP's baggage and limitations.
edit: hell, calling PHP a "web platform" at all is insulting. Maybe if "web platform" is constrained to JSP/PHP/ASP style pages with no more complexity. Don't mind anything that requires websockets or anything other than... PHP style page rendering.
Can we stop with the "PHP is everywhere so it must be good meme"? PHP's availability makes it convenient; it doesn't make it good. I said it before and I'll say it again despite its painful obviousness. If you want to write a random script and upload it to some $2/month hosting, PHP is great. If you're going to build a real webapp that is going to have developers working on it and real users hitting it, you're going to be on a VPS or colo or on your own metal and have all sorts of choices that... have package management and aren't PHP. And if we're talking about throwaway quickie scripts, who really cares anyway?
Congrats, PHP has a package manager. This does nothing to shake my feeling that PHP's most ardent advocates have little hands-on experience with the more full-featured alternatives. You know, like the ones that also have decent package management without PHP's baggage and limitations.
edit: hell, calling PHP a "web platform" at all is insulting. Maybe if "web platform" is constrained to JSP/PHP/ASP style pages with no more complexity. Don't mind anything that requires websockets or anything other than... PHP style page rendering.
Can we stop with the "PHP is everywhere so it must be good meme"? PHP's availability makes it convenient; it doesn't make it good. I said it before and I'll say it again despite its painful obviousness. If you want to write a random script and upload it to some $2/month hosting, PHP is great. If you're going to build a real webapp that is going to have developers working on it and real users hitting it, you're going to be on a VPS or colo or on your own metal and have all sorts of choices that... have package management and aren't PHP. And if we're talking about throwaway quickie scripts, who really cares anyway?
No, it's exactly as bad _of a language_ as everyone is saying it is. In addition, it filled a void that is no longer a void (dynamic HTML generation in a programmer-friendly way) and has rightfully been supplanted as the go-to language for new projects by a number of superior languages.
Oh, not this shit again. This article shows everything that is so wrong about people who continue to defend PHP
/PHP developer for 6 years
/PHP developer for 6 years
Granted, there has been a lot of PHP bashing lately and by and large, those who bash PHP the most - whether they are right or not - generally have little to no meaningful experience with it and are re-iterating whatever they've read about it. Fact.
However, this is just stockholm syndrome, plain and simple. Fabien is the author of Symfony.
However, this is just stockholm syndrome, plain and simple. Fabien is the author of Symfony.
PHP is easy to deploy on. That's it. That's why it's popular. It's braindead easy to go from text editor to web URL, it's braindead easy to unzip someone else's project and run it. It requires virtually zero sysops experience to be able to use. You don't even have to worry about setting those +x bits like you used to in the good old cgi-bin days.
For those of us who aren't afraid of a little ops work, there are far better options, and I say that as developer that's been using PHP regularly for going on 13 years.
For those of us who aren't afraid of a little ops work, there are far better options, and I say that as developer that's been using PHP regularly for going on 13 years.
"homeopathy" arguments.
For reference's sake, this article is written by Fabien Potencier, the creator of the symfony framework. This guy's probably single-handedly responsible for lifting the PHP community to a higher level, by making great software (which, when he started, was pretty unique, with horrible hacks-upon-hacks like CakePHP being the norm), and by showing people how to do so.
It's like he didn't actually read Jeff Atwood's article, or if he did, he entirely missed the point. It wasn't a rant about PHP; it was a rant about people ranting about PHP! So much heat; so little light.
I disagree, just because PHP has recently obtained features long available in other languages doesn't bring it close to being on the same level. All the other ecosystems are still light years ahead in terms of features, and contain fewer gotchas.
Yeah, PHP isn't perfect, we all know it has its quirks and oddities, but isn't that part of learning a language? What separates a hobbyist and professional PHP dev is experience, and knowing the correct method around such quirks.
In the end, PHP gets the job done. I've yet to come across a problem in my 11 years that was due to a bug or a quirk that I couldn't overcome.
Whether you defend PHP or rant about it, I still think PHP deserves respect within the programming community. It would be nice to see the end of rants and defensive posts, and for everyone to agree it's down to personal taste and experience. If we (defenders) are doing it wrong, then let us find out for ourselves.
In the end, PHP gets the job done. I've yet to come across a problem in my 11 years that was due to a bug or a quirk that I couldn't overcome.
Whether you defend PHP or rant about it, I still think PHP deserves respect within the programming community. It would be nice to see the end of rants and defensive posts, and for everyone to agree it's down to personal taste and experience. If we (defenders) are doing it wrong, then let us find out for ourselves.
Shitloads of people also believe in organised religion or naturopathy, doesn't mean that's a good thing.
> PHP is the best web platform... ever.
So because it's nearly caught up with other languages and you can install stuff easily if you have the prerequisite of knowing about composer? Bullshit.
I'm sure composer is great, but if your main argument is that PHP requires zero previous knowledge you can't really use that.