Look at this incredible thing Ian Baker created. Look at it!
What you're seeing is not Photoshopped. This is an actual photo of a real world, honest to God double-clawed hammer. Such a thing exists. Isn't that amazing? And also, perhaps, a little disturbing?
That wondrous hammer is a delightful real-world acknowledgement of the epic blog entry PHP: A Fractal of Bad Design.
I can’t even say what’s wrong with PHP, because – okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there.
You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes.
You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways.
You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever.
And on you go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools.
Now imagine you meet millions of carpenters using this toolbox who tell you “well hey what’s the problem with these tools? They’re all I’ve ever used and they work fine!” And the carpenters show you the houses they’ve built, where every room is a pentagon and the roof is upside-down. And you knock on the front door and it just collapses inwards and they all yell at you for breaking their door.
That’s what’s wrong with PHP.
Remember the immediate visceral reaction you had to the double-clawed hammer? That's exactly the reaction most sane programmers have to their first encounter with the web programming language PHP.
This has been going on for years. I published my contribution to the genre in 2008 with PHP Sucks, But It Doesn't Matter.
I'm no language elitist, but language design is hard. There's a reason that some of the most famous computer scientists in the world are also language designers. And it's a crying shame none of them ever had the opportunity to work on PHP. From what I've seen of it, PHP isn't so much a language as a random collection of arbitrary stuff, a virtual explosion at the keyword and function factory. Bear in mind this is coming from a guy who was weaned on BASIC, a language that gets about as much respect as Rodney Dangerfield. So I am not unfamiliar with the genre.
Except now it's 2012, and fellow programmers are still writing long screeds bemoaning the awfulness of PHP!
What's depressing is not that PHP is horribly designed. Does anyone even dispute that PHP is the worst designed mainstream "language" to blight our craft in decades? What's truly depressing is that so little has changed. Just one year ago, legendary hacker Jamie Zawinski had this to say about PHP:
I used to think that PHP was the biggest, stinkiest dump that the computer industry had taken on my life in a decade. Then I started needing to do things that could only be accomplished in AppleScript.
Is PHP so broken as to be unworkable? No. Clearly not. The great crime of PHP is its utter banality. Its continued propularity is living proof that quality is irrelevant; cheap and popular and everywhere always wins. PHP is the Nickelback of programming languages. And, yes, out of frustration with the status quo I may have recently referred to Rasmus Lerdorf, the father of PHP, as history's greatest monster. I've told myself a million times to stop exaggerating.
The hammer metaphor is apt, because at its core, this is about proper tooling. As presciently noted by Alex Papadimoulis:
What we ought to be talking about is not how terrible PHP is – although its continued terribleness is a particularly damning indictment – but how we programmers can culturally displace a deeply flawed tool with a better one. How do we encourage new programmers to avoid picking up the double clawed hammer in favor of, well, a regular hammer?A client has asked me to build and install a custom shelving system. I'm at the point where I need to nail it, but I'm not sure what to use to pound the nails in. Should I use an old shoe or a glass bottle?
How would you answer the question?
- It depends. If you are looking to pound a small (20lb) nail in something like drywall, you'll find it much easier to use the bottle, especially if the shoe is dirty. However, if you are trying to drive a heavy nail into some wood, go with the shoe: the bottle will shatter in your hand.
- There is something fundamentally wrong with the way you are building; you need to use real tools. Yes, it may involve a trip to the toolbox (or even to the hardware store), but doing it the right way is going to save a lot of time, money, and aggravation through the lifecycle of your product. You need to stop building things for money until you understand the basics of construction.
This is not an abstract, academic concern to me. I'm starting a new open source web project with the goal of making the code as freely and easily runnable to the world as possible. Despite the serious problems with PHP, I was forced to consider it. If you want to produce free-as-in-whatever code that runs on virtually every server in the world with zero friction or configuration hassles, PHP is damn near your only option. If that doesn't scare you, then check your pulse, because you might be dead.
Therefore, I'd like to submit a humble suggestion to my fellow programmers. The next time you feel the urge to write Yet Another Epic Critique of PHP, consider that:
We've got a long way to go. One of the explicit goals of my next project is to do whatever we can to buff up a … particular … open source language ecosystem such that it can truly compete with PHP in ease of installation and deployment.
From my perspective, the point of all these "PHP is broken" rants is not just to complain, but to help educate and potentially warn off new coders starting new codebases. Some fine, even historic work has been done in PHP despite the madness, unquestionably. But now we need to work together to fix what is broken. The best way to fix the PHP problem at this point is to make the alternatives so outstanding that the choice of the better hammer becomes obvious.
That's the PHP Singularity I'm hoping for. I'm trying like hell to do my part to make it happen. How about you?
| [advertisement] How are you showing off your awesome? Create a Stack Overflow Careers profile and show off all of your hard work from Stack Overflow, Github, and virtually every other coding site. Who knows, you might even get recruited for a great new position! |
>every server in the world with zero friction or configuration hassles
Actually I think this is very false. php.ini and compilation time configuration options can make your life hell with PHP.
great post, i agree with every single word of it.
Eatfrog on June 29, 2012 4:20 AMI work with PHP every day... and i must say... it really sucks!
For my hobbies i learn and use python for programming what i like and projects in my spare time.
I change from php to python in a second!
Flask and even django is much better framework (for web programming) than the famous Zend Framework (urgh!).
And i find python initial configuration very easy to do!
Obvious that i'm trying to get out of the PHP world, but still is a battle i'm losing... perhaps in time...
PS: Sorry for bad english... anyway
Rdenadai on June 29, 2012 4:21 AM"I'm trying like hell to do my part to make it happen."
Pardon my ignorance here, but what are you doing to make it happen? Which language are you pushing?
pgl on June 29, 2012 4:21 AM> make the alternatives so outstanding that the choice of the better hammer becomes obvious.
Uh... let me see... Python? Ruby? C#? You can run Python and Ruby on plenty of places, Heroku being the easiest. C# can run with ASP.NET in plenty of places too, or web pages (PHP-like file-based structure) thanks to WebMatrix, on... well many too, AppHarbor being the easiest.
We have alternatives.
Mircea Chirea on June 29, 2012 4:23 AMWhat could I do after building Stack Overflow... Stop the evil reign of PHP? Seems legit.
Thedotwriter on June 29, 2012 4:24 AMSomebody could compile a list of Perl5 modules which are useful for web programming and then create a meta module which depends on all of them
Then, installing would be as simple as `cpan Web::Programming::All`. Decent versions of Perl are installed by default in most Linux distros, so no need to install Perl itself
[ And in the future, when Perl6 is stable, do the same thing for Perl6 ]
gmariusx on June 29, 2012 4:26 AMAnd there's only one thing worse in my eyes than PHP, and that's Wordpress PHP. Take all the awful things about the language (and none of the good stuff, even in PHP4) then smoosh it up along with your own horrid procedural concepts like "the loop", document only half of it, get hundreds of developers to add their tuppence-worth, then smugly tell the world you power 22% of the web.
Arrrgggghhhh. It could be so much better with a rewrite, but they don't have the balls!
Dave_stewart on June 29, 2012 4:26 AMWhat commenter Tadas says about deployment headaches is largely true in my experience as well.
That said, one thing to consider might be finding some way to leverage PHP as a deployment vehicle. Surely it should be possible to code up some sort of VM in PHP that executes three-address code, or to write a compiler codegen module that outputs valid PHP from its internal TAC representation.
So in the ideal world, you come up with this amazing new platform, call it JeffScript or whatever. You provide a great native tool chain and reasonable integration with the big players of web serving (Apache and IIS I guess) and then, as a "side project," you provide an alternate deployment method that compiles to PHP (having coded up API bridges to the 25-30 most popular, but not part of the base package, PHP modules.) This approach has seen some success in things like Jython, Erjang, JRuby, etc. (Hell, there's apparently even a PHP -> Java bytecode compiler -- who knew!?)
The problem I see here is that part of the attraction of PHP is that for beginners/prototypers/contract-developers, there are mountains of bad, but free and quasi-usable code out there just waiting to be (ab)used. Full CMSes! CRM applications! BBoard systems! Frankenstien-ing up hybrid web apps seems to be a major passtime of PHP contract developers, and it's a feature that I struggle to see how JeffScript-on-PHP might leverage.
Just a thought.
Ian McCullough on June 29, 2012 4:29 AMOne approach would be to try and play the same trick as Dart or CoffeeScript - write a language that compiles to PHP so that you can deploy it currently, but with a view to replacing it with a more stable platform which takes advantage of your new language. It'd be very tricky to execute, but if it worked it could accelerate the move away from PHP.
Jos3000 on June 29, 2012 4:35 AMSince you mentioned the fractal post, you should at least read my reply to it.
http://blog.ircmaxell.com/2012/04/php-sucks-but-i-like-it.html
I think you miss a very key point, that sucking matters for shit when you're able to get stuff done with it.
Additionally, saying nothing has changed is a bit of a ruse. Follow the internals lists, and watch what's been happening in newer releases, and you'll see that lots has been changing.
Overall, just another FUD article. Sigh...
Anthony Ferrara on June 29, 2012 4:38 AMI wonder if developing an Open Source blog engine to rival Wordpress in another language would help its decline?
Paulmorriss on June 29, 2012 4:43 AMWhile I agree that PHP has a disorganized set of public functions - the basic class system is quite sane from PHP 5 onwards.
I have to agree with Anthony Ferrara on this one.
PHP is the easiest language to set up with a (*nix) web server. That alone adds a lot of value. In comparison, setting up Ruby or Python is rather scary.
PHP isn't the problem, bad programmers are the problem.
Besides, have you looked at makefile syntax?
Timw4mail on June 29, 2012 4:46 AMI think Anthony Ferrara hit the nail on the head.
The PHP community is practical above all else. What RoR does by developing an entire stack of functionality, PHP does with a few bash scripts, and then gets back to solving problems.
PHP sucks, C++ sucks, Javascript sucks, Java sucks, see a pattern?
I think the blog post entitled 'The Silent Majority of Experts' describes this blog post very well (http://prog21.dadgum.com/143.html).
Michael Reiland on June 29, 2012 4:52 AMJavaScript sucks pretty hard too, it exhibits some truly terrible design choices, but it's immensely popular and there are no signs of it's decline. There's been a trend in recent years to put emphasis on the importance of writing good JS, and avoiding the bad parts (bad parts as famously highlight by Douglas Crockford), and JS has benefited immensely from this - there's been an explosion in the depth, variety and of JS frameworks/libraries etc.
Perhaps someone should, as Mr. Crockford did, start highlighting what's good and what's bad (in the practical sense, instead of complaining) and start educating people on these things, so that those that care about code quality can get on with writing PHP, and writing it well.
Nick Williams on June 29, 2012 4:54 AMI have a long relationship with PHP. I've always thought it to be terrible (well, at least since the time I started high school), but I totally agree with you that it is near impossible to pick other choices.
PHP is supported on all shared web hosting servers. It is as easy as uploading your file and you are good to go. No strange CLI commands to run, no dependencies to download. Simple web form applications are really easy to get up and running in PHP (not as easy to make secure due to the non-existant type system). You don't even need to know PHP to use it, you can learn as you go. It's very easy to pick up and you can see all your changes immediately.
These are all compelling features of PHP. In comparison, how do you deploy a Python web script? I mean a simple one-or-two-files type of script. Do you use the Python CGI module? How easy is it to read the querystring and posted form data in Python? How well documented is this use-case? If I search for how to publish Python to the web I end up with a lot of Django, regardless of if I really need a full-featured MVC framework.
PHP is easy to deploy in a hackish manner. It only sucks when you are trying to leave the "hackish state" or write something secure. I therefore think that the "hackish state" is what needs to be implemented in other languages. It must be easy to set up a simple script hack, but equally easy to deploy high-quality products.
Here are some of the features I think needs to be fixed by the PHP successor:
* It must be easy to host. Shared web hosting companies must be able to do a simple "aptitude install perfect-language-web-package" or something similar and just tweak the configuration to their needs. The web hosting market is also heavily concerned with price so a free environment is preferred. This also sort of implies that there should be one preferred way of deployment, not a multitude of different methods.
* It must be easy to deploy. It is hard enough to get web developers to grasp all the intricacies of FTP and user permissions. To get into the market you should be able to deploy by just uploading your files.
* It must be well documented for web use cases. This includes tutorials, support forums and so on.
* The language must have web support. It must have good support for web technology like HTTP headers, character encodings, file uploads, form posts, sessions, databases and cookies. Preferrably even a really good Ajax framework. Bonus points if most of this is automatic.
I welcome a future without PHP and I am prepared to help out on this work. Please keep us updated!
Emil Vikström on June 29, 2012 4:54 AMNot arguing for PHP here, but it has at least four things going for it that other mainstream languages don't: low effort config, ubiquity, utility, and a short learning curve.
The newbie adoption experience for other mainstream languages and frameworks has a lot of friction.
And over time, the tools become more complex making newbie adoption that much harder (I'm looking at you rails).
There are some efforts at helping with this (e.g. Yehuda Katz's promising Tokaido).
But that's the exception, and it seems to me that the real solution to taking down PHP is providing an easier on-ramp for novices.
Ptrcksmth on June 29, 2012 4:56 AM@Anthony Ferrara
"I think you miss a very key point, that sucking matters for shit when you're able to get stuff done with it."
Well said and to be honest the only people who should give a shit are the people writing software, there is no perfect language that everyone loves and at the end of the day it's our customers and users that should be the focus.
Programming language debates are about as relevant and useful as games console wars, use what you know and what you like, and deliver what the users want, because pretty much anything can be achieved in any language.
I dislike PHP, but do I care? Does it affect me? No, not at all, and that's the way it should be IMO.
K Lawrence on June 29, 2012 4:57 AMI disagree about the frictionless everywhere comment. This may be true for apps written with only the core of PHP but start to get into the extensions and you can get all kinds of incompatibility problems.
God help you if you need to run Pear modules.
I once spent two days with a rock star sysadmin getting the ecommerce engine Magento to install right on CentOS. I think we even had to edit a make file at one point.
Ryber on June 29, 2012 4:59 AMIf you want to get rid of PHP, keep it conceptually simple. Mircea said that Python or Ruby are alternatives - they are not. Non-programmer people would need to learn about classes and objects*, and about how a good web app generates HTML in at least two steps** and how to map*** tables to objects (that they have not yet understood) and what are modules and why they are important and...
Or, well, one can start with PHP, learn how to do a "Hello, World" in two minutes and save some data in MySQL in ten minutes.
I am a Java programmer at work (could be no more corporate-y) and a Python developer in my projects (could be no more hipster) but I admire PHP and its ability of solving problems. It grows because, some times, some poor soul wants to create an online encyclopaedia, or some teacher needs an online teaching platform, or someone wants to write a blog. Those people do not want to learn to program, they want to solve problems.
I thing most projects to defeat PHP are doomed because programmers got it wrong. PHP is not in the same league of Python, C#, Ruby, Java or whatever. PHP is more like Excel, a not-so-beautiful tool for helping laymen to solve problems with a computer. And you know what? I like spreadsheets, although they are extremely shitty from a programmers perspective (PROCV() anyone)?
Paulmorriss proposes to write an alternative to Wordpress. Nice! After that, create an alternative to Mediawiki, Moodle and OpenCart as well. Oh, and do not forget: they should be useful, stable and easy! Now, let me tell my history: I was a fiercely advocate for Linux in my undergraduate days. I was always pointing how it was more stable and secure. What used to happen is that people kept asking me how to, let us say, edit MS Office documents or running AutoCAD or using Photoshop. With some time, various open source projects created solution to it. I liked it because I am an Ubuntu user and I need these applications, but for the common people from windows, they are lame clones for something they already need. Also, if they needed some application, they could hack it with Visual Basic or Delphi, while they would start learning about autotools(!!!) in Linux. All these alternatives people created, as great as they are, just did not solve the real, bigger problem, that is to empower non-programmers. It does not matter how many alternatives to real applications in PHP you create - the poor user will stay disenfranchised if not using PHP.
So, this is it. If you want to ban PHP, create a new as-easy-as-Excel tool for the web. It will be ugly, because those tools are aimed to little problems, but do not delude yourself that people out there care about the "elegance" of your language. Everything our favorite languages has was put there to satisfy us, not PHP users. If we want to win, we need to unlearn.
But do we want to create another unlearned tool?
* And man! I was a C programmer and it took me some two years to get it
** First, generate the data, then pass it to a template engine.
*** Every time you say the word "map", you can count on your layman listener getting lost. This is hard mathematical stuff, you just forgot it because you are used to it
What needs to change is the notion that hosting your own web app, using open source software, involves uploading "scripts" to "web space". As long as this is the way 99% of hosting operates, PHP will maintain its prevalence.
All the things going on with virtualized cloud hosting are key here. Move from the paradigm described above to where installing your own instance of, say, a blogging engine means uploading a complete VM image (or chef/puppet cookbook, or whatever) to your hosting provider, and open source developers are once again free to use their favourite technology.
(Disclosure: I'm the author of Schnitzelpress, a tiny Ruby/Sinatra based blog engine that was mostly born as an experiment to find out how much of the above is possible today.)
Hendrik on June 29, 2012 5:10 AMAs a fellow programmer forced to use PHP on daily basis, you all miss the worst part of the language - the terrible terrible debugging and tracing options. If you have a complicated project it is almost impossible to debug with anything else than print_r or echo. I feel like being punished for lots of sins.
So if your open source project is something that can get the world off of PHP without invalidating all the old working and tested code - just show me the github link.
Daniel on June 29, 2012 5:10 AMWhat we are trying to achieve with Composer ( http://getcomposer.org ) & Packagist ( http://packagist.org ) is to bring PHP to a higher level by encouraging sharing of small libraries. Encouraging re-use by making it dead easy to publish a package and depend on others.
This means less wheel reinventing, and overall people get more time to work on their one specialized lib instead of having to write boilerplate crap over and over again. So we end up with higher quality libs, and everyone wins.
That does not directly fix the language, but it helps a lot by abstracting crappy C-like functions under much more usable OO APIs. Curl has wrappers, GD/Imagemagick too, streams are coming. This creates a nicer "DSL" on top of PHP, so that all you're left with from core is the language syntax and a few string and array manipulation functions that are not as consistent as they could be, but it's not so hard to learn if you use them every day.
I find we these are exciting times to be writing PHP.
Seldaek on June 29, 2012 5:10 AMSo, Jeff, where do I sign up for the team? :)
Vilx- on June 29, 2012 5:12 AMMagento is not a good example of PHP. I've had to deal with Magento, and I describe it as being written by Java developers who decided to use PHP for the ubiquity of deployment.
Michael Reiland on June 29, 2012 5:12 AMRemember: You can write FORTRAN in any language.
People will even take your beautiful, perfect language/ecosystem and write PHP in it.
Skyborne on June 29, 2012 5:15 AMThere's a technology with pure saturation and you want to throw that away. Terrible idea. Embrace PHP to gain the saturation you could never hope to get on your own. PHP runs on ALL servers. Who can replicate that? If Java, Python, Ruby, and .NET can all fail to achieve the same ubiquity, what chance do any of us have?
Replace "PHP" with "JavaScript" in your article -- it's the same problems. Only choice for a language for its scope, terrible design decisions, yadda yadda. Yet the entire modern online experience is based on it. How have we coped and even thrived with JS? One solution is by embracing it as the backbone to make better libraries as was done with jQuery. Now we have an awesome library that runs on all browsers.
Robert McRackan on June 29, 2012 5:16 AM@Emil Vikström
Doesn't Perl already fix the 'hackish state'? While you can use frameworks, you can also write a simple script with the CGI module. It is also very easy to deploy [ upload files and you're set ]
Also, it has good support for web stuff. CGI [ or Apache2::Request in Apache's mod_perl ] does all the parameter parsing / HTTP headers / file uploads, CGI::Cookie does cookies, DBI does databases, FCGI does FastCGI, etc.
It also has quite good web-related documentation, or at least that's what my googling-skills found.
It only needs some metapackage-style module which depends on CGI, CGI::[stuff], HTML::[stuff], DBI, FCGI and other useful modules for web programming. Then, installing would be `aptitude install libweb-programming-perl` or `cpan Web::Programming`
@K Lawerence
The fact that PHP is widely used affects all web programmers. More users == more/better libraries == easier development in that language.
@Timw4mail
What's that difficult in setting up Python/Perl/Ruby/Any_Sane_Language? You install an interpreter for that language, some modules/extensions/gems [ these two steps are one `aptitude install ...` command ], you configure your webserver for CGI/FastCGI and you write scripts. As easy as PHP
@Paulmorriss
I would help, since blogs are a big part of the internet. However, there should also be some other very-used projects in the Miracle Language [ maybe stuff like e-commerce, maybe a generalized CMS, maybe a forum and maybe others ]
@Jos3000
Compiling stuff like Ruby/Perl/Python to PHP is not easy. Making a new language which has the same amount of libraries/written code as Perl, Ruby, or even Python has takes a lot of time. Therefore I think we should aim for a language which already exists
gmariusx on June 29, 2012 5:18 AMI have been using PHP for years. I've heard all of the critiques. Many times. The most common point about them all is that they have not evolved over the years. People that hate PHP have been hating it for years and they still have PHP 4 in mind.
It's a bit like saying Java is horrible by thinking about applets or J2EE.
The language has evolved since. It is possible to write beautiful code in PHP. Just look in the direction of Symfony2 and Doctrine2. Sure there are quirks, but there are some in every language. Just unit test your code and you won't have bad surprises.
There is plenty of truly horrible PHP code out there. But there are a bunch of truly pathetic programmers too, and they happen to share their code. No language is going to make novice programmers write good code. The language might make it look good, but any good programmer with experience in the language can point it out.
Don't like PHP? Don't use it. Unlike JavaScript, it is not imposed on you.
lphuberdeau on June 29, 2012 5:19 AMAgree @Anthony Ferrara
"I think you miss a very key point, that sucking matters for shit when you're able to get stuff done with it."
I've seen so many cases where the customer threw out a carefully designed solution, developed at great expense, in favor of an internally hacked PHP site. Management regrets it, but the people on the workfloor are in love with the PHP site.
Likewise, I've never seen an official PHP project fail. The result might offend the OOP developer, but there is always a result, and it always does more it less what it was supposed to do. If I compare this to the success rate of Java or .NET projects, I can only hang my head in shame.
I've long thought the reason for this is Boyd's Law (http://www.codinghorror.com/blog/2007/02/boyds-law-of-iteration.html) PHP basically forces you to iterate from day 1.
PHP delivers.
Andomar on June 29, 2012 5:25 AM@my previous comment
"I would help" should be "It would help"
@Robert McRackan
Don't Python/Perl/Ruby also run on all servers? Perl and Python also tend to be installed by default on most Linux distros
@Adam Victor Nazareth Brandizzi
You don't need to know what objects are to write Hello World in Python/Perl/Ruby, or to store something in a database. You just need a code example, and then you can start writing PHP in Python/Perl/Ruby :-)
[ Well, non-programmers should be just that: non-programmers. That's the problem with both Excel and PHP: they turn non-programmers into semi-programmers which output massive amounts of awful code ]
gmariusx on June 29, 2012 5:28 AMI think if we look at the history everything we see has glory days. but in real world everything is just an 'Leaky abstraction' as said by great joel. language is as good as abstraction it feels.
I have used every server side scripting language and i found most of them are unreliable and having huge problems. take asp.net when started they created great abstraction by dragging and dropping components it putted all code and when something got wrong developers of .Net didn't knew what was the problem cause they never worked with underline technology. weather it was web forms code messed with JavaScript or anything else to create abstraction.
The reason i believe php used by so many devs is its as natural with html and css as much you can get and it never really get into the way of developer who wants to do something. if you want to do some system task they give you functions you can run system commands. you don't need to learn those 20,000 namespaces to work with something simple.
The problem part is people think they can deliver high performance apps with php. if you have really huge application just deliver the front end with php and use something appropriate to manage back end. cause php at the end of the day is scripting language not JAVA or C or C++.
So DEAR JEFF, STOP Renting on PHP or start renting on everything. :)
Hardikdangar on June 29, 2012 5:32 AM> Don't Python/Perl/Ruby also run on all servers? Perl and Python also tend to be installed by default on most Linux distros
No. And there's not much else to say about it.
> You don't need to know what objects are to write Hello World in Python/Perl/Ruby, or to store something in a database. You just need a code example, and then you can start writing PHP in Python/Perl/Ruby :-)
Deployment in PHP *tends* to be much simpler than the other systems. Go look at deploying a RoR app, for example. That isn't to say there aren't exceptions, but in general the above is true enough that it matters.
> [ Well, non-programmers should be just that: non-programmers. That's the problem with both Excel and PHP: they turn non-programmers into semi-programmers which output massive amounts of awful code ]
That makes people millions of dollars a year. You're forgetting that the people paying you don't care about anything except the result. And the results speak for themselves.
Michael Reiland on June 29, 2012 5:36 AM@Daniel You should give XDebug a try.
Napych on June 29, 2012 5:39 AMNothing makes me love PHP more than people who tirelessly talk about how shitty it is...
Msgmash on June 29, 2012 5:52 AMI'd have to say that the reason PHP is ubiquitous is not because of Jeff's mistaken claim that it's easy to install - it's flippin' easy to *use*: just inline it with your HTML in a .php file, and Apache magics it out to the world (I should know - I write in it for all my scripted pages).
If Python were as simple to embed (yes, it can be done - but it's not the same from a simplicity viewpoint), we wouldn't have to deal with "PHP SUCKS!!!!11!!!" posts every few weeks. We'd deal with "PYTH0N SUCKS!!!!!111!!!!1!" posts instead.
Until random morons like me quit embedding our logic into our display (ie, until we all move to an MVC or similar paradigm), it won't matter what the 'language' is, it will all suck.
Warrenmyers on June 29, 2012 5:55 AMTired,
PHP is already dead!
Web apps need to deal with lack of connectivity, therefore must handle data and other functionality on the client. Only one language can do this on the client and server.
We are saved from PHP by JavaScript ;0)
Mike Farrow on June 29, 2012 5:58 AMAs has been said previously - an Open Source ecosystem that can compete with PHP in ease of use, but without its faults, sounds terribly promising. Where and when can we find details?
Pekka Gaiser on June 29, 2012 6:01 AMA thought just struck me - ok, so maybe you can build your perfect "PHP killer" - but how will you get it adopted in the world? PHP is like a social network - people come because everyone's there, and everyone's there because they come. It's the classic chicken-and-egg problem. How do you intend to get the "critical mass" of popularity to get it rolling?
Vilx- on June 29, 2012 6:08 AMCompletely ignoring the main point of the blog post, I'd put the glass bottle in the shoe and use it to hammer the nail.
Ccallebs on June 29, 2012 6:10 AM@Napych - tried it. Still find it lacking compared to the ease of debugging with vstudio.
Daniel on June 29, 2012 6:10 AMI've been reading a lot of PHP bashing blogs lately and they all share the same problem. The problem with blogs like this one and especially "PHP: A Fractal of Bad Design" is that people bashing PHP don't actually know much about PHP (i.e. almost every statement on that fractal blog post is wrong, good explanation here: http://blog.ircmaxell.com/2012/04/php-sucks-but-i-like-it.html). It's ironic how people can make sarcastic remarks like this "“well hey what’s the problem with these tools? They’re all I’ve ever used and they work fine!”" and yet they're actually the same, just with another toolbox in another playground.
If anyone has a good explanation on why PHP is bad, without all the snobbyst remarks and assumptions, with actual proper knowledge and experience with the language he's analysing, ideally from someone who works with it right now (no, hacking up PHP4 code in high school doesn't count), please don't hesitate to share it.
Inoryy on June 29, 2012 6:16 AMLets put this another way. If every PHP dev and piece of software switched over to Python (or what ever other language you decide for force everyone to use), what would change? Would all of those devs suddenly become five times better (and by what measurement)? Would all of those apps suddenly be seven times faster and use 50% less memory? Would this stop every dev from ever having a SQL injection issue, or prevent all XSS?
There is plenty to groan and complain about in PHP, no doubt of that. But clearly that isn't enough to stop it from being useful.
The notion that all would be fixed in the world if devs only used a "well" designed language just hasn't held water. I think it is paste time to get over it already.
Joseph Scott on June 29, 2012 6:23 AMGodspeed Mr. Atwood. If you can succeed with your new venture the way you succeeded with Stackoverflow you will deserve some sort of award.
There seems to be a bad language or bad framework stockholm syndrome out there. "If you just got to know PHP like I have you'd see it differently." "PHP is really doing what's best for me." "PHP really isn't that bad once you get used to it."
Of course you could replace PHP with a lot of languages and still be accurate.
Andrew Kothmann on June 29, 2012 6:37 AMbut to build compelling alternatives
Mixing code and content is awful, but compelling for someone who doesn't know better. There is nothing else that provides the type of immediate gratification of something that "works" as PHP, and this is the most insidious characteristic of it. Any alternative's barrier to entry is, like the rent, too damn high for most people (unfortunately).
B. Estrade on June 29, 2012 6:45 AMAs one of those many self taught programmers that do PHP, where can I foolow this exciting "awesome opensource alternative to PHP"-project?
:)
Would be great to learn & and grow with this "new language" as it is beeing developed!
Victoriawagman on June 29, 2012 6:51 AM+1 @Victoriawagman
Jeff, could you at least tell us what the language is? I don't see the point of keeping it a secret...?
Chad Mikolajcik on June 29, 2012 7:00 AMPHP as a whole is terrible, I won't deny it, but it's still usable if you use a good framework that encapsulates some or most of the PHP awfulness behind its abstractions.
In this case you still have to deal with "pure PHP" from time to time but your "house" will not have a roof upside-down, consider it as constructing with cheap materials :)
Is this a price worth paying? May be, depending on what you're trying to accomplish.
Httpheaders on June 29, 2012 7:04 AMAnybody who think that the choice of programming language one uses makes any form of difference whatsoever is suffering from a severe delusional state which can only be cured via copious intakes of some form of alcohol and a smack about the head with a clue-by-four.
Language *doesn't matter in the slightest*. If you magically converted all PHP code to some other language overnight, then would it make all those programs better programs? Would it make everybody a better programmer?
Answer to both of these is no, because the "program" is not the end-goal, it is only the means to get to the end-goal.
If I'm a user, then I don't care about having a spreadsheet program, I care about getting my work done with spreadsheets more easily and quickly. I don't care about the email program, I care about sending my emails easily and effectively. I don't care about the web publishing tool, I care about publishing content on the web more efficiently.
Users don't care about language. Only programmer-nerd types like us do. But we're not paying the bills, we're being paid by the users to develop software for them.
And this leads to the bottom line:
The tool that works best is the one that gets you paid fastest.
Now, that tool may be anything depending on circumstances, but for web publishing, well, you pointed it out yourself. It's clearly PHP. It's everywhere, it's easy-to-use, it's fast-as-hell to develop with... even if it does have many, many problems from a pure programmers perspective.
PHP is a language for getting things done rapidly, with not much in the way of advanced skills being absolutely required. Sure, you can develop highly advanced structures and systems in PHP (especially since PHP 5.3), but the base-entry level is still HTML+PHP=FTW. Novices can (and *should*, IMO) start with it.
If you want to develop a better alternative, then focusing on the language itself will doom you to failure. PHP succeeded because of its usefulness and utility, not because of abstract and non-marketable ideas like language-syntax-purity and so forth. Any alternative must be immediately useful and easy-to-work-with, and trying to make the language somehow better from a pure programmer's perspective invariably makes a language harder-to-use, as far as I can tell.
PHP is rarely the bottleneck
Skirtap on June 29, 2012 7:12 AMThe beast feature of php is the manual and the community. It's awesome being able to find solutions very easily.
Trying to figure out how something works in MSDN for .Net is like sticking nails through your eyes. It's like it was written by lawyers and marketers exclusively—just jargon and shameless promotion, but not much real information.
Of course, the difficulty in reliably searching for .net or c# is part of that.
The PHP manual with the user-notes is a dream come true. What can take a full day to research in the MSDN manual takes seconds on php.net.
THIS is what you have to duplicate to replace php. Make it easy to understand, RAPIDLY. You need a good manual, with user notes, that gets updated and a community of passionate people who like discussing trivial matters.
The language itself is secondary or even tertiary to it's success. That doesn't mean you can't make it awesome, but an awesome language is not enough nor is it a necessary prerequisite.
Jeffrey Davis on June 29, 2012 7:23 AMThe solution is not to pick another programming language and make it ubiquitous for web applications. Instead, improve the interface and packaging model for web applications. I Am Not a Fan of Java, but the one thing it has going for it is WAR. If you've ever tried out something like Jenkins, for example, it's as easy to run as "java jenkins.war". And if you already have a fancy web server, you just drop the file in a directory.
In my opinion, standardizing on an interface (like FastCGI) between the web server and the application, plus a mechanism for packaging and deploying a complete application with its dependencies, independent of the programming language, would go a long way toward making a world where you're not forced to consider PHP.
The other side of the coin is accessibility to new developers, and that's an area where each language/framework should be actively competing. Here again, redirecting some of the time and energy wasted on packaging and deploying to improving the learning curve would be a good thing.
The objective tone of this article is a bit off given the obvious author bias.
As some commenters have pointed out PHP has improved considerably in recent years; any new critique should be on the current stable version of the language, not how it was in 1999
No toolset comes even remotely close to what php was actually designed to do: generate HTML from simple data structures. That is the key point that everyone seems to miss in these PHP SUXORZ debates. If you are trying to write an image processing/manipulation library from scratch in PHP, you are doing it wrong. If you are trying to implement a new database engine from scratch in PHP, you are doing it wrong. If you are trying to ANYTHING in php besides manage user input from http requests, load stored data, and generate HTML from that data, you are doing it wrong. It might be a cool experiment to build a distributed map reduce engine in PHP, but there are many reasons it's a bad idea, mainly that you don't end up generating HTML directly from a completed map reduce job.
I do think that auditing the consistency of some of the more archaic functions/APIs is a good idea. I personally hate having to lookup which comes first in a explode() or a strstr() if I brain fart for some weird reason, but I don't blame php because I am the one who forgot the order after using it over 1000 times. PHP plays nice with every almost every system available, I have never seen issues with other programs or tool sets not being able to run because php is installed in a box.
It's time to become better programmers and pick the right tool for the task, not the "job". If you get over the fact there is not a superior programming language for all things you need to do then you will start to get the right picture. Then you begin to understand that you need to broaden your porgramming horizons and constantly learn new things and new tools. Then you start heading to a point where you can weave the best tools together to create functional art where everyone else didn't even bother to look because, well, PHP LOL!!
TL;DR: PHP will continue to not give a shit about "becoming a better language", and everyone else can continue to mock it from their sky castles and unicorns. I will still use it to generate awesome HTML with minimal fuss and almost never worry about deployment issues.
Matthew Glinski on June 29, 2012 7:35 AMI don't really buy the "PHP is easier to deploy" argument anymore. I don't know what the situation is in the Python world, but Phusion Passenger (a.k.a. "mod_ruby") has been making Ruby deployment very easy for a few years now.
The real issue is that many people who do PHP development either don't have the knowledge or the desire to configure a server, so they go with shared hosting options that already have PHP, Apache, and MySQL preconfigured. But if you gave a developer shell access to a new virtual or dedicated server, it'd take about the same amount of time to configure and deploy a PHP or Ruby app (I've made a living doing both).
The aforementioned lack of knowledge is unfortunately pervasive in other areas of the PHP community. In my experience, the average PHP developer doesn't know much about UNIX/Linux, doesn't know much about databases, doesn't know much about separation of concerns, and either doesn't know or doesn't care much about best practices.
All those things are okay if you're using PHP as a templating language, which was its original purpose. But I've maintained for a while now that if you're serious about the craft of software development--about achieving excellence in your work--PHP just might be a career hazard. I've moved on in my professional life, and I no longer even accept side projects doing PHP.
For some people, life is too short to use inferior tools. For others, life is too short to worry about the tool. Both viewpoints are defensible, but I think we have to accept that the aspirations of these two groups are very different.
Jon on June 29, 2012 7:43 AMSeeing that photo, at first I thought that you are going to praise you new hammer that you just bought for $199, and elaborate on how it was worth that price..
Account Deleted on June 29, 2012 7:48 AMJeff, you may get it. Realize that there are many people out there who don't, though. Lots of developers use PHP day-to-day and think its flaws are fine and dandy. Those are the people that really need to be reached.
JoelMcCracken on June 29, 2012 7:49 AMThis is the fault - or rather, the pitfall - of open source software. It's due to the narrowed perspective of the designer. People who don't have to expand their awareness to include the realities of others (because they have to - commercial software companies demand it, and ignore it at their peril) end up creating applications that fully satisfy just one person - themselves - for a while.
Brilliant software works for many people and is updated rapidly in response to user requests. Think WordPerfect for DOS in the mid-1990s. The company responded to user requests and incorporated the good ones quickly - you could buy an update disk for $15 every few months.
Then along came Microsoft with marketing power and a bad attitude and bad software...and we haven't had a decent word-processing app since.
George Beinhorn on June 29, 2012 7:50 AMPHP's epic fail is not in language design on implementation. There are FAR worse languages out there (anyone know ActionScript? and apparently AppleScript is comparably bad). No, PHP's fail is that it managed to get to be ubiquitous. It is everywhere and there is copious legacy code which needs to be supported (and it is cheaper to support bad but working code than it is to rewrite from scratch). And, of course, because the legacy code is bad PHP, the new code also has to be in PHP to be compatible.
Personally, I prefer Python (or Lisp... I dream of a Lisp-1 world... sigh...), but so long as PHP is paying my bills, I will hold my nose and use it.
Christopher Allen-Poole on June 29, 2012 7:53 AM"PHP is the Nickelback of programming" is not a good analogy.
Wordpress is the Nickelback of programming, and PHP is the electric guitar.
Thilo Savage on June 29, 2012 8:07 AMIf your approach to a "new PHP" is as obtuse and scatterbrained as Stack Overflow, then I don't think PHP is in trouble. Seriously, a family of sites rather than just having categories? Each site w/ its own rep total? And weird-ass badges and rankings of all different kinds? This "suite" of sites is like the web version of Donkey Kong 64 -- packed with extraneous nuggets and low on core fun/usability.
If you truly manage to come up with something that competes with PHP and yet is more "pure", I wish you all the best, and I'll be first to extol its virtues. But I sure don't see it happening.
I have a William James view on the issue of programming languages. Pragmatism is king.
Brade on June 29, 2012 8:20 AMHere we go again...
Maybe it does suck. You can certainly tell it was not designed by computer scientists. In many ways, it throws away years for programming language best practices.
This being said, what are the practical alternatives? JSP? Servlets? ASP? Python/Django? Ruby/Rails? What?
I am sorry but JSP, Servlets, ASP, Python/Django, Ruby/Rails are just shit of a different kind. But they do not deserve that holier-than-thou aura.
I suggest bad programmers keep blaming their tools for their own shortcomings. I suggest that when bad programmers have produced enough horrors to sully a tool, they blame the tool and move on to the next tool.
http://prog21.dadgum.com/142.html
Josh Engroff on June 29, 2012 8:32 AM
“Broken gets fixed. Shoddy lasts forever.”
I agree with @Adam Victor Nazareth Brandizzi. People do not care about the elegance of a language, they care about solving problems. I am a C# developer at work, and it is by far my favorite programming language. I spent time developing PHP applications in my career. From that time I learned I can write PHP in a way that makes me sane. Does PHP suck as a development standard, absolutely, is it going to be replaced for what it is, probably not.
There are good programmers, bad programmers and wannabes. I would love for the bad programmers to go away, but they won't. Refer to your please don't learn to code posting, and when you do look at PHP again and you'll see that is their solution to your plea. It takes very little to learn in order to do something useful to the average person using LAMP.
There are languages I will never use because I just don't like them for one reason or another: Ruby, VB, and Coldfusion to name a couple. I try not to bash them or the people who choose those languages even though I think there horrible. What I do is not use them myself and stay away from projects that would force me to use them. You need to stay away from PHP, and you can if you want to. Program and let program (live and let live); but teach the ones that want to be teached to be better and make better choices, which I think is one of your original motives to write this posting.
Just my two cents, thanks for the morning read.
Mgeiser on June 29, 2012 8:45 AMWhy do we need all these anti-php rants? I get the distinct impression that the authors of posts like this one have quit using PHP a few versions back and now that they feel all superior with their new found language they need to publish a work that secures their ego. Here are some facts (I found very few in Jeff's post by the way):
A low barrier of entry is not a bad thing. Read Ian Landsman's blog post where he mentions his 60 year old dad hobbying with PHP: http://ianlandsman.com/2012/06/29/PHP Can you easily tell a friend or new developer how to deploy a Python, Java, or Rails app? As for the argument of "terrible tutorials" on the web there are also thousands of great ones due to the high availability of PHP. Choose a reputable teacher.
PHP has changed since V4. I know, quite a shocker for those of you that left a few years ago. It's now OOP. It has closures. Yay!
There is such a thing as beautiful PHP code. Check out the frameworks http://Laravel.com and http://FuelPHP.com
Wordpress is popular due to it's early start. It is *not* a good representative of a PHP CMS. There's a number of well coded CMSs out there. http://PyroCMS.com is one such non-spaghetti PHP CMS.
PHP has momentum, JavaScript has momentum. jQuery did wonders for JavaScript. There is nothing wrong with sticking with a language that has momentum and using tools to make you write great code.
Jerelunruh on June 29, 2012 8:50 AMYou all need to get over the whole bad programmer/bad language thing.
Bad that works is not bad. If you think you're getting paid to write code then you are the problem.
Programmers get paid to solve problems.
No one who matters in the solution space knows or cares how you get the job done as long as it does get done.
Mr. Atwood, please don't mess up PHP the way Adobe messed up Actionscript.
Scott Fadick on June 29, 2012 8:54 AMPlease, take off your hate glasses.
A chunk of the comments showed a lack of reading comprehension. Maybe if you read just two choice parts again( without your hate glasses ) you will calm down.
From the article:
"Is PHP so broken as to be unworkable? No. Clearly not. The great crime of PHP is its utter banality. Its continued propularity is living proof that quality is irrelevant; cheap and popular and everywhere always wins."
Wait, What? PHP works? Off topic, anyone else spot the typo?
"What we ought to be talking about is not how terrible PHP is – although its continued terribleness is a particularly damning indictment – but how we programmers can culturally displace a deeply flawed tool with a better one. How do we encourage new programmers to avoid picking up the double clawed hammer in favor of, well, a regular hammer?"
Don't Attack! Offer Alternatives. BALDERDASH! ^_^
Don't force the guy already using PHP to do anything. Awe, come on! That'll take FOREVER!
Thank you for the article Jeff. Lots of good links to read, and thoughts to chew on.
Peelle on June 29, 2012 8:59 AMGreat post.
@Jos3000 makes a good point. It might be far easier to make an interesting (read: not utterly banal) language that compiles to PHP than it would be to create yet another language (a real hammer) and make it so popular that its pervasiveness would make it attractive to the masses.
CoffeeScript is a good example of a language that compiles to JS and actually makes it a better alternative to plain JavaScript. And there is already a few languages that compile to PHP as well (Fructose, Pharen, HaXe). But none of them really convinced me so far. Still, I'm eager to see more of those compilers appear in the future. I believe there is a huge market for such a language.
Juliend2 on June 29, 2012 9:02 AMOne of the possible ways how to avoid PHP is to persuade hosting providers that hosting something else than PHP doesn’t have to be that complicated. Which might be one of the best things about my employer's, Red Hat (sorry for pimping them, but I really have no other benefit from OpenShift than pure joy of writing real world Python), providing whole hosting platform OpenShift Origin and making it freely available (both beer and speach; https://openshift.github.com).
Otherwise, PHP causes me a deep long attacks of melancholy. How come that most interesting FLOSS projects which matter most (wordpress, owncloud, status.net) are writing in something like *that*? Is there any other evidence of presence of Evil in the world needed?
Matěj
Matej on June 29, 2012 9:06 AMIt seems like the real issue is not PHP itself as a language, but rather that the barrier to entry is so low (just put some PHP tags in a .php file and hack away) that a lot of what is written in PHP is cargo-cult copy/paste jobs by people who have no programming experience or training and have no idea what they're doing.
If you make something else that has a barrier of entry as low as or lower than PHP's, won't the same thing just happen in that language? And if the barrier to entry of the new thing is even slightly higher, won't people just continue to use PHP?
Brad Westness on June 29, 2012 9:15 AM"What we ought to be talking about is not how terrible PHP is – although its continued terribleness is a particularly damning indictment – but how we programmers can culturally displace a deeply flawed tool with a better one. How do we encourage new programmers to avoid picking up the double clawed hammer in favor of, well, a regular hammer?"
..By informing them of why PHP is to be avoided, like Eevee's blog did. And then subsequent posts on how to get started on Python (There are similar posts for other languages as well.)
Inaki on June 29, 2012 9:17 AMStarted with BASIC, learnt Pascal, switched to C, C++, learnt Java, then started web developing with Perl. Then, one day, we paid an external developer for a project in PHP. I knew nothing of it. We had to make small modifications, so I opened the files and looked at the source. It was an unknown language, but I could read it. It was sort of simple. It was sort of readable. Had no "How to start with PHP" course or tutorial. I bought books on Java, Javascript, C, 68K Assembly code, C++, SQL, Ruby, DHTML, Cocoa, ActionScript 1+2+3, and most shit out there.. But thinking of it now, I never, ever, bought a single book on PHP! The online reference was incredible (today it is still a benchmark for others, in my opinion). In a few days not only I had made the modifications, but had started learning the new language in a way that allowed me to learn and become more productive while I worked. It sort of absorbed me. This implies writing better code while you go, yes, so the code you wrote before, is horrible compared to what you write later. But what I can tell is this: I still love PHP, I love the logic of it. Variables are variables, functions are functions (if you think this is obvious, think again). Accessing things inside arrays/objects is clear and simple (if you think this is obvious, think again). I definitely love PHP arrays. Now probably most newer languages have something as powerful, and you give it for granted, but the first love is hard to forget. Gosh, I even don't dislike variable variables (i mean $$var)! Sorry, love is irrational, you can't argue against it.
Francesco Munafò on June 29, 2012 9:22 AMI honestly have no idea what you're talking about.
PHP is terrible, but why do you need to consider it? I've never had the slightest bit of trouble finding hosting for other languages and tools. You can deploy a Python or Ruby or JavaScript web application to Heroku in like five seconds; if you get some cloud hosting from Rackspace or Dreamhost or EC2 it might take you as long as fifteen minutes.
This "available everywhere" thing is just a fallacy. I can't think of a single platform that has PHP that doesn't also have both Python and Ruby and a trivial way to get all your dependencies installed. And in fact, as much as the Python packaging ecosystem needs an overhaul, installing and configuring PHP dependencies for any non-trivial application is an enormous nightmare, especially if you want to install more than one thing on your web server! In Python it's just virtualenv, pip install, and you're done.
Maybe some hosting providers offer PHP but not other things, but you know what? Just don't use those providers. There's a huge, highly competitive market of hosting out there, and every part of it that I can see has excellent support for reasonable tools. Heck, you can deploy on Heroku for free.
Didn't your parents ever tell you that if all your friends jump off a bridge, you shouldn't jump off of it too? Well, PHP is that bridge. Don't do drugs, Jeff.
Glyph on June 29, 2012 9:23 AMProblem with PHP is not PHP. There are easy alternatives (Perl::Dancer, python::flask, ruby::ramaze).
And, this is exactly what you are calling for: a cheat sheet for php devs to code web app in python:
http://me.veekun.com/blog/2012/05/05/python-faq-webdev/
The problem with PHP is the lack of abstraction amongst PHP developers.
For them there is no differences between a float (an implementation) and a number (an abstraction), a char * and a representation of a string.
The problem with PHP is also the lack of knowledge of how computer works.
When they do abstractions, it is pitiful. Astronaut architects striking back (symfony, propel, doctrine...)
The problem with interacting with PHP devs is like being caught between a dysfunctional hammer and a dysfunctional anvil. Still, it hurts.
Julien Tayon on June 29, 2012 9:25 AMI've always liked the two headed "hammer" as an accidentally appropriate metaphor for most complaints about useful items, but the way I read it is:
Adding a month to a UNIX timestamp, C vs. PHP: https://gist.github.com/3019006
That's right: PHP managed to screw up a perfectly good C API. How do you screw up a trivial wrapper around a C function?
Sure, I can make this code clearer by asking for an associative array, but that's not the default behavior. That still doesn't let me pass the array back into mktime, for two reasons: mktime expects each element it cares about as a separate argument, and mktime doesn't use compatible bases for the month or year.
This type of nonsense is spread out all over the language. Yes, things have improved with PHP 5 over 4. At least objects are passed by 'sane reference' now (there's no other way to get a sane reference in PHP, so in 4 you were screwed unless PHP's odd take on references happened to work out for you). PHP's learned to fake it a little better, but it still does not behave like a reasonable language.
Sure, you can get work done in PHP, but I'm all for coming up with something better and using it wherever it makes sense.
LnxPrgr3 on June 29, 2012 9:45 AMI like the Nickelback analogy, though you could also say that PHP is the Windows of programming languages.
Paul Blair on June 29, 2012 9:52 AMWow. I haven't seen a double claw hammer in years. As Lukewelling pointed out, the double claw hammer is a fairly bad example for this kind of discussion and referencing said hammer and pointing out its failure to hammer nails illustrates is misunderstanding of how to properly use said tool.
This makes no allusions or any kind of commentary on coding ability/etc. Just a commentary on the choice of non-coding illustrative example, which can be summed up and applied to many things in life: just because you don't understand the usefulness of a tool, does not make it useless.
I agree with lphuberdeau. Not mentioning great frameworks for PHP seems unfair.
Emmanuel Parfond on June 29, 2012 9:58 AMPHP isn't popular because it's easy, it's popular because people using it are more interested in getting things done that debates about syntax.
Truth is despite the chaff if you're interested in writing good code in PHP you can. The rest is bull, to be blunt.
Streaky81 on June 29, 2012 10:10 AMJeff,
Just as many people would cheer the death of Nickelback, many would cheer the death of PHP.
I can think of a handful of choice languages as the basis to build an alternative. I'm guessing that you're going to get your most support from the community that has grown up around that language.
So, out with it - how are planning to break up the band, Yoko?
Richard Perrin on June 29, 2012 10:13 AMUm, Jeff, you do realize that you built your sites on the Microsoft stack and ASP.NET, right?
You look at PHP and you sneer. A lot of people coming from the open-source stacks would sneer at ASP.NET ... viewstate hidden fields, really? (Yeah I realize they have improved since then.)
Don't get me wrong. I think Ruby and Node.js are the shiznit. But just like any other language, once you get used to PHP, you can do some amazing things in it. I am not talking about Wordpress, Drupal, Joomla, and user adoption. I am talking about making web applications that regular people can host, where you change one file via ftp and they are instantly updated without having to restart your server. I'm talking about isolated scripts so one request can't crash the server, about about class autoloading so they can just drop in a library and it works, about include( ) where and so forth.
Of course, it doesn't help that most frameworks in PHP are just clones of Ruby On Rails or something like that. We released a framework that "truly" takes advantage of what PHP is about, http://phponpie.com as open source. And in the two years since then, we have enhanced it a lot as our framework Q. You will hear about it soon.
Disclaimer: PHP, while useful, still suffers from the same problems that most imperative programming languages for web design do. The number of requests that it can handle at the same time is limited to the number of preforked processes. The worst part is when those processes have to wait on I/O. That's why evented is the future, and why Node.js rocks.
Gregory Magarshak on June 29, 2012 10:40 AMWant to muscle PHP out of the "cheap and easy" niche?
Make sure your stuff works on cheap shared cPanel-driven web hosts!
D_minus on June 29, 2012 11:07 AMPHP is like democracy. It's not perfect, it might not even be great, but it's the best we've come up with so far.
Michał Tatarynowicz on June 29, 2012 11:20 AMAnalogy: "I'm so sick of people speaking English. It's a clumsy language, a mutt of all others, and there are better alternatives that are more elegant and easier to use. I wish we all could write poetry in a better language."
Who cares? People speak English as do people write PHP. It's pretty easy to create a great platform with it, and explaining its inner-workings is cocktail fodder. Performance is acceptable, PECL is great, the documentation is par, and the community is vast.
So, the problem here is basically a disdain for the positions of curly braces and underscores? There are too many regex functions? Your $, >, or ; keys are broken? Zend's ORM isn't Railsy enough?
If you are fed up with it, then write more JavaScript. Everything behind the client is fast becoming glue for databases and filesystems anyway.
Smartj on June 29, 2012 11:23 AMI reckon Jeff's talking about this! http://golang.org/doc/
Solutionmania on June 29, 2012 11:28 AMI have recently started working on a service oriented single page webapp, I don't have much to back me up but I prefer to use Java with any of the available frameworks as my service layer and with a front-end which is built solely using HTML5, CSS3 and JavaScript. You can brag about Ajax security concerns, SEO and cross-browser compatibility all you want, but nothing will change the future. At least it is my belief about which direction web is moving towards.
Esfandiar on June 29, 2012 11:35 AMI think some critics of PHP are missing the point. If the purpose of a software development environment is to ease the creation of software that solves peoples problems then PHP is a solid environment. Perfect no. Solid yes.
In effect the marketplace has spoken.
This is similar to the discussion technology analysts made when the iPhone was first released. Many of them promptly declared the iPhone, and then the iPad, dead on arrival. The problem was that the marketplace and the analysts were defining different criteria for "good". Analysts were looking at features while users were interested in solving day to day communications problems.
Personally I still think that Pascal is one of the better languages I have used to create programs but when I needed to select a programming language for a business I was building I chose PHP, not because of its syntax, or structure, or support for objects, or computational performance, or (lack of ) support of multi-threaded code, but because as an environment -- which includes the number of programmers that know how to use it -- it was the best choice at the time (2005).
When evaluating technology we need to define the criteria of evaluation and ensure we are focused on the correct audience.
Irvshapiro on June 29, 2012 11:35 AMAnother follow up on this:
PHP is easy. That means you will have many people making use of it. Non-coders and coders alike. It is easy for non-engineers and non-CS majors to grasp and start using.
Another thing going for it: Wordpress.
Tonnes of themes, plugins, etc. Wordpress is easy. Widely used. VERY functional.
I've been looking for a way to move way from Wordpress and PHP to say Python. No go. Nothing approaches the ease of use and feature sets. Sure, I can roll my own. Start with Django or go lower level with Twisted. But then it becomes a support nightmare for long term maintenance of themes, plugins, core code, etc.
PHP has flaws. But then again, every programming language has flaws. And in many cases, the flaws depend on who you ask, the usage case, etc.
But in terms of survivability of a language, PHP rocks where it counts. IE, widespread usage, plenty of documentation, an AWESOME online web search at php.net, and without much technical knowledge you can make use of the language. Language survivability isn't the same as language elegance.
In that context, a cockroach, rat, cats, etc. might be a better image to represent what PHP is: a hardy language that refuses to go away.
Wingedpower on June 29, 2012 11:46 AMI'm not exactly sure what there is in this article that so many people seem to be agreeing with. He does't like PHP, OK that's one thing. What else? Any critique of the language? Does he support his position at all? No, he just reiterates in different forms that he doesn't like PHP. Somehow it's like a hammer without the hammer, or a screwdriver without the handle, and we're left to just assume that's true. But, how, exactly? Are we supposed to just take the authors word for it?
Perhaps it might make sense to propose a viable alternative? Or give examples of things PHP does poorly and how those could be done better?
I had a job writing websites in PHP 10-12 years ago (the php3-4 era) and didn't like it then. But it got the job done. What I dislike even more though are boldy stated assertions lacking in supporting arguments.
Mike E on June 29, 2012 11:46 AMMike E, the original article has more specific points http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/
Emmanuel Parfond on June 29, 2012 11:53 AMI started off with Javascript, then tried PERL... but that didn't work out well. So I tried C... and C++... but I wasn't getting anywhere fast enough. So back to PERL I went... and that continued the disaster. Finally I switched to a cheaper webhost & they had PHP. Suddenly, I was able to get things done in PHP, and done quickly. That saved my butt in '99. About a year later, I tried getting into PERL again... but it was too much of a hassle. Same with Python. I got a little ways with C, but realized fast that it would take a long time before I'd be good enough to replace my PHP code with C. So, why bother?
Eventually... years later... I dove into Python and started taking the time for it. I'm now writing more Python than PHP, but my point is... none of these other programming languages are so well suited to the web as PHP. With PHP, you can just program and get stuff done... barely any need to mess around with things like permissions or setting up things on the server in any way. If these other languages started making it as easy to get started as PHP does -- I think PHP would fade away. Until then, it's easiest for newbies to start life on PHP.
Devon Young on June 29, 2012 11:54 AMWhat if you just put the bottle in the old shoe ? What kind of tool would you cast this way ? Here's the answer with this awesome conversion table, and I challenge you not to laugh :
http://php.net/manual/en/types.comparisons.php#types.comparisons
_v1nc3nt_ on June 29, 2012 12:08 PMWhere do I sign for this proyect of Anti PHP Movement (I know that sounds quite radical let me rephrase)
Where do I sign for the Movement of the PHP Alternative project?
Luis Robles on June 29, 2012 12:09 PMHow about this for not eating your own dog food?
https://1105registration.com/VisualStudioLive/2012Redmond/registration/index.php?
The real question is this: Are you programming a language or are you programming a solution?
Having been a classically train (CS) programmer with years of experience in C/C++/Motif and Visual C++, PHP is a pure joy. I don't have to futz around for hours just get a damn app to compile. I write, I test, I deploy. Done.
Maybe it's that real programmers WANT to design garbage collectors and really grasp why you shouldn't pass a CHAR* to STRING to a WCHAR_T...
Not me. I want to do this: "print($mydata);" and have it just f'en work.
-CF
ChronoFish And More on June 29, 2012 12:34 PMWordPress in Python. That's all it takes.
Lkraav on June 29, 2012 12:57 PMI'm currently making a living from my PHP + MySQL clone of a Rails + Postgres app. I started the project ~6 years ago because Rails was such a whore to deploy, hoping that it would become redundant within a few months as rails became widespread. But no, PHP + MySQL *still* has about 99% of the "cheap-as-hell shared hosting" market share, with no alternatives, and I'm still maintaining that project since so many people rely on it. Not a day goes by when I don't want to strangle a PHP developer for their retarded design decisions :-(
Please, somebody, make it so that I can just drop "index.fcgi" into a directory and it will run that code (in whatever language) as a fastcgi process (with the user ID of the file owner); then get that module installed on 95%+ of cheap shared hosts. I *really* want to rewrite my software and compete with the other clones based on quality, and not on me being the most willing to tolerate PHP's bullshit. Heck, even if that makes the python / rails / node.js clones easier to deploy and makes my project entirely useless, at least the world would be a better place...
Python is easy too! Just ssh in, create a virtualenv, use pip to install dependencies, upload your files, set file permissions, use root access to configure your web server to load the app via fastcgi, spend a few hours debugging all the glitches, and you're done!
I have no idea how anyone thinks that this is as easy as "upload files, done" :-| Heroku and co come close, but they're still more difficult than that, and they're *way* more expensive than bog-standard shared hosts.
I personally hate having to lookup which comes first in a explode() or a strstr() if I brain fart for some weird reason, but I don't blame php
This reminds me a lot of Stockholm Syndrome. PHP causes pain so consistently that people consider it the norm, and they think it's amazing whenever it manages to do something only *slightly* awful. Once they're attached, it could say that 1+1=3 and they'd still rather blame themselves than the language...
Shish2k on June 29, 2012 1:38 PMThis is only a preview. Your comment has not yet been posted.
As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.
Having trouble reading this image? View an alternate.
|
|
Traffic Stats |
Posted by: |