Sam says you should read this
This blog was created with the BlogFile software, written by Samuel Levy.

You can find Sam on Google + and LinkedIn.
 

PHP is the right tool for the job (for all the wrong reasons)

Which job? Well... most of them. At least, a very, very large number of them.

When people complain about PHP being a horrible language, not fit for human consumption, they will often talk about how the features of their favourite language are far more refined; have been designed with elegance in mind; are consistent and secure. And you know what? They're right.

But PHP is still a better tool.

When people write very long blog posts about the horror that is PHP, which lead to double-clawed hammers being created, then they're right.

But that double-clawed PHP hammer is still a better tool.

And it shouldn't be. It really shouldn't. I want another language to knock PHP out of the way. I want to use python wherever I now use PHP. Heck, I'd even take Ruby or Java. I can't, though, because PHP does one thing really well that no other language seems capable of doing.

It works, out of the box, for people who don't know what they're doing. The install process for the vast majority of PHP projects comprises of the following steps:

1. Put files here.
2. Done.

"Installation" of database then takes place inside the application. It's configuring, not installing; the application is already running.

And this is the problem with every other language. The process is beyond the uninitiated. It doesn't matter how spectacular your package manager is, or your special requirements files, or your pypy, or your gem store. They all require prior, specialist knowledge to set up.

There is a massive chunk of the market for web software that consists of small businesses, hobbyists, and people who generally don't have a huge budget. They approach software like they would approach buying a toaster - they want something that does the job, and doesn't cost the earth. This is where PHP has excelled with projects like Wordpress, Joomla!, Drupal, Magento, Moodle, PHPBB, and so many more. PHP has provided a platform that is so easy to use, that it can be sold, at a profit, for under $10/month. PHP has provided a platform which is accessible to the people who can't afford to pay the price for a full, custom software solution.

This is the market that PHP has cornered, I'm sure entirely by accident, by being the only language that makes deploying a website effectively idiot-proof. The people who use the obviously-superior-language-of-their-choice don't see this, because they aren't building for that market.

Imagine a chef from a fine-dining restaurant writing long-winded rants about how horrible McDonalds food is, because it's made of simple, no-effort components; how McDonalds should close up shop, throw out their entire menu, and then come back when they're making gourmet food. Everyone would roll their eyes, and say "Well that's the bloody point of McDonalds, you numpty!"

PHP caters to the people who don't have much money, who don't have their own skills, and who the $300+/hour "Enterprise" developers wouldn't want to cater for.

I am a freelancer, and I take on these clients. When the budget permits, I'll use a language that is better suited to the problem, but more times than not, I use PHP because my margins on these jobs are already so low, that I would be insane to attempt to use any other language. I don't have the budget to use rare white truffle, or the time for slow-roasting the pork, as it were. I have to make the burgers and fries of the programming world because we've all got to eat.

It's not just getting a language deployed easily, it's also getting the language deployed cheaply. To stretch the analogy that bit further, why would I serve my burger on a bone-china plate, with sterling silver cutlery? Why would I do that and then insist that my client pays the extra costs to eat their cheap burger on a fancy plate?

Most often, the best hosting available for these clients is shared hosting. Big, cheap, crowded servers, stuffed with so many websites that there's barely room to breathe. These servers don't offer complicated python stacks, or passenger applications (well most don't; Dreamhost does, but it's still an arduous journey to get it running). They can't offer them, simply because it's not economical for those hosts to support these applications. PHP is so easily set-and-forget, that $10 hosting actually becomes plausible.

This is why PHP still exists. It is simply the best tool for the job of providing me with money in my bank, and food on my plate. When someone comes along looking for an application that comes with a wine selection, then I'm more than happy to build them what they want. Those jobs just aren't as frequent as I would like, though, and until they are, or until any other language can provide me with the tools to make tasty, tasty burgers wrapped in paper and cardboard, then PHP will stay.

This is the challenge for all the people who want to complain about PHP - if your chosen language is so much better (and I have no doubt that in many ways, it objectively is), then make it accessible in the way that PHP is. Until then, keep that double-clawed hammer in your shed in case you want to make... burgers...

OK, analogies officially ruined.

Name
Web
Comment
Formatting: _itallic_, *bold*, #mono-space#, -strike-through-
warambil

Great post! totally agree ;)

 

I agree, and I had actually wrote an article as well on the topic just a month ago! PHP has got its own very specific set of killer features, and nobody is going to dethrone it in the short run.

http://ollivander.franzoni.eu/2013/01/17/php-killer-features/

 
Anonymous

Agreed

 

You are absolutely right. I am a hobbyist programmer. I have dabbled in PHP and Ruby. There are many features (high level abstractions) in ruby which are simply awesome but configuring it on a server is a pain in the ass. By the way I have not been able to install gem on my machine.

PHP works like magic. With little effort I have created simple and non trivial websites. Wordpress and Magento make PHP indispensable.

Nice post!

 

I love PHP for the ease and speed at which I was able to build and deploy my web applications. Awesome database support is second to java.

 
Anonymous

Thumbs Up

 

Thank you. Let's dispense with some of the elitism and get down to business! I am trying to teach myself Perl, but probably know a lot more PHP off hand just because I've been using WordPress for so long and it's easy for this noob to access.

 

Very well said! This is why PHP is still my favorite language for building web apps, and I laugh whenever I see those anti-PHP rants.

 
slightly agreed

"PHP caters to the people who don't have much money, who don't have their own skills, and who the "

I really like this piece, for the most part. I have a very similar belief to yours about PHP, but with one difference.

I myself have been programming for almost a decade, and I know other programmers who have 3 under their belt. BELIEVE me, they do not choose PHP because they are "uninitiated"

They choose it because anything beyond the installation/configuration of PHP is completely UNNECESSARY. Almost intolerable. There is no need for a web-server and its server-language to be complex.

 

Awesome post. I kind of like to think of PHP as a swiss army knife.

 
FennNaten

I only partially agree with you.

- IMHO, for any business holding sensible information about its customers, professional support should be mandatory. (that's not restricted to php though).
- The "easy to use and deploy" is some kind of an illusion. Yes, if you just use out of the box functionality provided by a (good) hosting provider and a simple pre-made soft, it may be true. If you want anything beyond that, welcome to hell. PHP configuration is one of the messiest I have ever seen. That's one of the reasons for php being so used and so profitable for "web agencies": it's marketed as simple, non technical people invest in it because of that reputation. It starts well, than it turns worse and worse, then either the user possess a "developer mind" and learn by himself how to rock the hard way, or he struggles and have to call a professional.
You say other developers have a bias 'cause they're not in the same business, I think that PHP enthousiasts often have a bias 'causing them to (unintentionally I guess) "market" their solution as simple, because they know all the (numerous) quirks, and tricks required to have things properly working.
- Regarding the costs, you can use all web stacks for free nowadays if you pick the right tools. The cost argument was relevant long time ago, not anymore.(even a full featured windows shared hosting won't cost you more than 10$ a month. In fact, the rent of your dedicated ip will cost you more than any hosting. I speak by experience, I currently rent one for some tests). Hosting providers don't bother offering other stacks partly because there is a huge demand on php; and there is a huge demand partly because everybody knows there is a huge hosting offer... That's a typical market domination mecanism, when you have an actor growing huge at some point, it's then hard for the other to compete, even if they're better in an objective point of view.

 

Very well said! This is why PHP is still my favorite language for building web apps, and I laugh whenever I see those anti-PHP rants.

 
Gooutandplay

This is exactly why php frameworks should be championed. Good php frameworks enforce best practices. Good php frameworks remove the dangers that come with using raw php code. This somewhat macho attitude of frameworks only being a crutch for newbies is not professional. Or the more ridiculous assertion that frameworks make it 'too easy' for people to build web applications. For every python or ruby developer pssing about php, there are a herd of php developers trashing each others php frameworks. The newest hot framework in php is Laravel. Google or twitter search Laravel and you will find many of the posts bitterly complain about the codeigniter framework - even though the creators of laravel were supposedly inspired by codeigniter! Its this idiotic trash talk that makes supposedly experienced php developers look like spoiled children. Would you want pouty brats anywhere near your business critical applications? You want to hire developers who will build you an app in a framework - and then a year later scream that the framework - and hence your business critical application - are now tired and dying? This kind of behavior makes php look very unstable from the outside. What compounds this perception is that its the whiners who blog and twitter post the most. Good news is there are many hard working developers building real long term business value with php. So thats my final advice - stop thinking in the short term. Stop obsessing over php 5.2 vs 5.3 vs 5.4. People built real applications that created millions of dollars of business value - with PHP 4. We know the language version and features are going to change over time. Now concentrate on the VALUE of what you are creating, the value of what your web application does for people.

 
Oli Griffiths

Hmmm, this article offends me slightly.

Whilst I agree that there are definitely haters of PHP for the wrong reasons, focusing on PHP being a good language because its freely available and simple for "noobs" to pick up doesn't hold much weight as an argument for or against the language.

PHP, whilst it does have its nuances, is far more than just a simple and easy to pick up programming language that someone can learn in their bedroom.

In fact, I feel that very statement is what almost harms the PHP community. The lack of discipline in writing web applications is astounding, and there is a lot, I mean, A LOT, of really shoddy PHP code out there that employs very poor programming practices.

PHP is so much more than just a "hobbyist" language, and we need to get away from this view point that it's just for "scripters", not real programmers, I can't begin to say how much that phrase annoys me.

PHP is evolving into so much more than what it previously was, and for the better. What it does afford you is the ability to get up and running and build something with ease, with few barriers to entry, but the language offers so much more for those developers who want to make real applications, not just "websites".

Any way, rant over :)

 

Indeed, good sir.

 
Samuel Levy

@Oli: PHP is developing more as a language, and I'm not saying that it's an easy choice because it's a "noob language", I'm saying that it's a choice that I take for many clients because it's easiest for them. It's easiest for them to understand, to get support for, to get hosting for, etc.

@FennNaten: Yes, there are other low-cost hosting options, but there are very few low-cost managed hosting options. I am not in the hosting business (any more), and don't want to have to re-start servers at 3AM for clients who don't have the budget to pay for an extended support agreement.

Aside from that, most clients already have hosting. They are already on a shared host somewhere, because they found it themselves, or they have an existing site. I need to be able to work with what they bring me. If I start turning down clients because they don't see the point in renting a VPS (even a cheap one), and can't afford extended support agreements to keep their the servers behind their site running, then I'm going to starve. It's not a matter of pushing clients towards other technology because I can; it's a matter of providing clients with technology that they can afford now and which they can afford for the next 2/5/10 years. I may not always be around to support them.

 
Anonymous

well said, nuff said!!

 
Markus Bauer

I share the same opinion. You nailed it with the double-clawed hammer.

 

Good Job pal... really a very good answer(punch) for the post which i read recently...

http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/

All hail PHP/MySql.....

 
rtpHarry

Morbo reluctantly approves this message!

 
Artur ABC

Bravo !!!!

 
Jader Turci

Here we're moving from C++ and C# executables to intranet PHP.
Ten times faster to edit, debug, deploy.

 
Anonymous

I love your analogies...

 
Anonymous

I completely agree that the main value of php is its easy setup. But it's not true that PHP alone give us this feature (Put file, done)

You will be surprised, but ASP.NET has it for instance. With aspx or cshtml files (cshtml is a damn cool/simple templating engine, with all the goodness that C# has to offer).

put an index.cshtml with something like "Hello world ! @DateTime.Now" on an out of the box ASP.NET server (Mono or IIS), and it works. However, it's true that for any big applications, developers tend to prefer working with ASP.NET MVC, a little like Symfony is available to PHP devs.

At the end, choosing a language is a matter of choice. What really often makes one better over another is our available skillset for the task at hand. Nothing beats a small script for a Scripting task, whatever the Scripting Platform.

 

I'm kind of an old timer - learned FORTRAN with a deck of punch cards (Feed-Register-Release, anyone?). Went on to VAX assembler and then found "C". It was the first language that really was really fun. Back then, it was my first experience with a truly typed language A concept that made sense after learning assembler,

PHP - it's one of the oodles of descendant of C. With a smile - no typing. Whilst I put C++ at the top of a resume, .php would come next.

Interestingly, the IJW feature of M$"s Visual Studio (available for C++/.NET), crossing between managed and unmanaged code, is something of a hint at the fun of PHP. It's kind of IJW extended to an entire language, still with the familiar look of (real) C.

It's a living breathing answer to the Question: What If ? Almost like running naked on the beach.

I've become an Evangelist for PHP

For those who don't approve of it? Well, maybe they forgot that programming is supposed to be fun.

 
steveoyugi

Thank you, thank you, thank you. I feel better that you got this out to the masses, I have always held it in and figured someday I may just explode at some fellow that keeps bugging me about how inappropriate php is and the assumption that it is not a real language

 
Joe Pritchard

Great post - thanks for a pragmatic, common sense post!

 
Anonymous

Yes! That is the very problem. If you want to deal with people that have no money then stick with PHP. If you want to make money, then focus on corporations and organizations that have money and are willing to pay for projects that use other languages. PHP is for the poor, and if you want to be poor, stick with PHP.

 

As a longtime C/C++ veteran, I will opine that PHP is becoming the C++ of the web. It's ubiquitous, cheap, well-supported, and it works. And, it can be as well-written or as poorly-written as you want it to be. As a result, it is as controversial as C/C++: reactions to it range from hateful revulsion to marital bliss. I'm now learning Ruby as part of a startup opportunity, and so far feel as though I'm ascending an awkward learning curve to grasp a language that reminds me too much of BASIC ("What? No curly braces?"). Right now, I want to scream, "Let's just build this thing and get 'er done with PHP+CodeIgniter!" But, I'm not the boss, and people rave about Ruby, so we'll see how it goes.

 
neverhome

Good article. Well said and accurate.

 
Anonymous

Excellent post, finally a real world point of view.

Just to reply to a post about ASP. Yes, easy as well. But find me a cheap hosting plan. Plus look at all the aspx sites, they tend to be really sluggish. PHP is lightning fast and hosted everywhere.

My analogy on this, "why use a sledge hammer to kill a flie".

 
Tonimuiller Alves

I completely agree with you.... great post. I think that a telented programmer is not those that just use the best development tool(language) for every project but, is who choice the right tool for the project in question. If php is the best for your kind of project... ok use it, or if it's asp... ok use it, if it's Delphi(my case rsrsrsrs).....

Sorry for the poor English, I'm Brazilian and I don't speak english.

 
Anonymous

Good post! As an amateur who codes in C#, Java, C++, PHP and JS/HTML, I do get annoyed by people who insist that scripting languages like PHP and JS are rubbish because they don't support all the features of Java or C#! Of course they don't - they are scripting languages! (In part what they really complain about are the IDEs rather than the languages). For many purposes they are fine: JS usually runs easily on a wide variety of platforms without complex platform-sepecific deployment and PHP is fine for simple database applications which a hobbyist or small business may use. Maybe if one's scripts became 10 000 or more lines long then one maybe ought to consider alternative technology. Traditionally the low cost of PHP/MySQL servers have been instrumental in their success. I have recently rented space on a C#/ASP.NET server and I am currently writing some stuff for it. My site is complex, but in the end I struggle to see what I need ASP.NET for which PHP and JS/HTML 5.0 can not do, but I am learning ASP.NET anyone because I enjoy software development. I think that one project I am planning will benefit from ASP.NET, but that's a special and complex project, which could probably be done otherwise, but ASP.NET would probably be better and so justify the time I invest in learning it. I am also using ASP.NET just to learn for fun. Incidentally, renting space on servers that support MS is sometimes now quite cheap, for the most basic support, especially with hosts in countries like India. However, you are quite right - those who complain should offer an alternative that works well for small scripts and is just as cheap and easy to deploy.

 
Steve

I'm a development VP, with degrees and a solid grounding in theory of procedural and OOP languages, and years of experience with a list languages as long as my arm. I love PHP for one simple reason. Programmers using it get projects done.

What the architectural elitists fail to recognize is that if you want to use a super solid awesome architecture that is fully OOP and eminently supportable...you need to go back to school and get your Phd. That's where OOP pays the bills.

In business, clients don't pay for pretty code. They pay for code that is complete and does what they want. Under the hood it can be the ugliest godawful mess mess you've ever seen...they do not care, they will still write a check.

If however, it's still not done because you need to redesign the presentation layer to accomodate this functionality request that wasn't laid out until 5 weeks into the project...well, they still aren't writing a check until it is done!

Developers coming out of college are always hyped about the best design models, writing code the "right" way. It seems to take them a few years to realize the "right" way is the way that puts food on the table and a roof over your head.

PHP gets that done.

 
Jimu

I've been working with Python somewhat seriously for over a year now, and have in the past used PHP.
I have no idea what you mean about PHP being easier to configure.
Can someone explain?

 
Anonymous

I only have one thing to say after this looooong rant. What's a "numpty"?

 
mike

>"Plus look at all the aspx sites, they tend to be really sluggish."

Ahem. That's BS. Unless someone can cough up some numbers.

Anyway, agreed that for a lotta-lotta people, the emphasis is on get it done, now, cheaply. Moreover, the lifespan of many sites is < 2 years before the owner decides to redesign it or replace it or abandon it -- not worth a large development investment anyway.

 
Marty Power

Absolutely agree - I've worked in many languages, going back almost three decades, and the one thing I've learned is there's a tool for the job. Not the tool you WANT to use, or one you really like, but the one that fits the task at hand, and, as you so wonderfully state it, one that fits the client's budget.

Remember that Julia Child and Jacques Pepin both loved McDonald's fries as well...

Marty

 
Tharnid

Agreed.

Php just works...not pretty...but easy to set up

 

Hear, hear! Time would be better spent making the 'other guys' as deployable as PHP than convincing us to stop eating burgers. Or something.

 
Worldly Wiseman

Language snob-ism. The rants against PHP remind me so much of the parallel, perpetual rants against C++.

Meanwhile, those rants are written on software, within an operating system, with calcs drawn from a spreadsheet, rough drafts printed using a device driver, etc., etc., that are all in C++. (The late, dim Sun did not help this, when its marketing implied that OpenOffice was a Java product, all the while the only parts of it in Java being only those specific parts that talked to Java; everything else was, naturally, C++, because it was faster and better at WORA than Java.) And, of course, those rants against PHP and C++ are published on systems using PHP to generate/control/facilitate web content, using MySQL [the HORROR!] for website data control. Le snob fait du vent; il ne fait pas le travail.

Boutique coffee is so much better than water! Anyone who drinks tantamount-to-free water instead of paying $5 to $15 a cup for WeaselPoopDuJour (now with hazelnut flavor enhancers!) is a fail...

 

I agree that the installation process for PHP is almost too easy, which has allowed projects such as Wordpress, Drupal, Tiki Wiki, and others to be approachable by those with limited budgets and limited on-site development skill. Even clients swimming in money and development skill often choose these solutions over writing their own because they often 'just work' right out of the box!

It would be nicer if the PHP stack were easier to install on Windows, though. I know there are compiled binary packages available, but clients don't often get them installed properly or miss important features.

 
Anonymous

+1
great post :)

 
Anonymous

Umm Ruby on Rails is a free out of the box solution and so isn't Django and now we Node with soon to be consumed out of the box solutions for that platform as well, so I totally don't agree with this post.

 
M_A_S

PHP is like smoking. Everyone says they can quit any time. Sure they know it will be better for them in the long term, but like smoking, it does harm in the long term.

I don't think anyone will defend that PHP is poorly designed---and by designed, perhaps coalesce is a better term. The disturbing thing is that precious little has been done to try and fix it's shortcomings over the years. This is one of the most damning thing about PHP.

And don't give me that "it just works" bull. I have seen too many php.ini and compilation time configuration nightmares.

PHP: Just say no!

 
Panz3rGr3nadier

I think that visual web developer express for asp.net is better than PHP, because it's free and it allows you to use the .net framework. Out of the box PHP is for web developer students and for web designers at most, a web developer either uses a paid framework for PHP or uses other tools all along.-

 

I believe PHP is/has become the BASIC of the web world.

 

So basically, what you're saying is that PHP is a wonderful way to allow someone who has no idea what they're doing to construct a website for your business... OK, then!

 
Doug

This may be an oversimplification of things.

I have to deal with PHP every day at my job, and I hate it. Not because the language isn't capable. But because of the type of developer that tends to select it as their preferred tool. They make my life hell.

I know that PHP applications can be made to be secure. But the problem is that developers that are comfortable with PHP and don't have experience in other languages don't seem to understand good programming practices, whether that be writing code that isn't full of security holes, or implementing proper garbage collection or efficient use of resources. I have found that programmers that prefer PHP simply don't know better, and most don't care. The prevailing attitude is that if the code actually runs and does what it is supposed to (under ideal conditions), that it is good enough. Never mind that it is slow, or that it blows up when input data isn't perfect or someone decides to take even the slightest interest in poking around for security vulnerabilities. Most PHP developers aren't even aware of what SQL injection or Cross-site scripting are, and PHP does nothing to encourage developers to develop around these issues. It sometimes even gets in the way of doing so.

PHP does have a place, but in my mind it is the cause of many major problems because it doesn't encourage good programming technique. A developer using PHP needs to take time to educate themselves on what the right way to program rather than hack their way through it and post bad code on the public Internet just because it ran right one time.

 
Anonymous

I'm a burger chef - where do I get one of those PHP burger cooker thingy's from?

 
dotNet Guy

I am an ASP.Net, also use PHP when I have no choice.
Deploy a simple site by simply dropping the files in? ASP.Net got that.

Self configuring applications? Well you do understand that this is a custom feature of the app and not the language? Also I have seen one of those PHP selfconfiguring apps: "You have to give write permissions to a folder on the web server before the app can be configured". Guess what, give an ASP.Net app permission to write to its config folder and it could be self configured as well.

PHP hosting is cheaper? Lately have seen including free hosts for ASP.Net. Some use IIS, some use Mono, still fact is that you can find a decent host for ASP.Net for the same price as it would be for PHP.

PHP is easier to edit? Ahem, compiling the app is recommended, but not required. There are methods to deploy your app so that the server will dynamically compile the files on change. Not to mention that some of the code you will want to hide from the client anyways, so you will precompile portions of the web app into dlls.

Oh and did I mention that ASP.Net code is shorter than PHP code for the same things (in most cases shorter, and at times way shorter). And I really love the predictability of PHP. You always know how a piece of code will execute with any parameters. Good luck sorting your nulls.

P.S.: it was mentioned that PHP is easy to debug. Exactly! A PHP "hello world" is easier to debug than an ASP.Net one, even taking into consideration all the traps that PHP has for an unwary person. Who cares if PHP works wrong - it works! and nobody cares that html injection is a default feature in asp, that code page handling in php is pretty much nonexistent, and if someone on your fancy english site writes using one of the unicodes suddenly your site starts doing weird things because of this. Never had to worry about strings being in the wrong codepage, since ASP.Net primarily works with unicode and knows thus how to handle eg Chinese without corrupting the data.

So sorry if I will not believe you that using paper tools instead of a proper cooking set is good even for burgers. Pretty sure that even McDonald's uses proper tools.

 
Anonymous

For an extra buck a month you can get almost the same easy setup and a much better language to develop in with some shared ASP.Net hosting.

And it has proper isolation and permissions so you won't get hacked because you're on the same box with a site built by a noob.

 
Anonymous

Finally a post that explains PHP's role without truly trash talking it. You have both sides of the fence in this article.

I'll remain a PHP user even when a rival language appears. I've been using it for so long, I'd like to stick with a language I know since it just works.

 
bwana

Agree 100%!!! PHP does the job and does it well!

 
Anonymous

great article

 
Anonymous

What some of you are failing to see when talking about language superiority, and efficiency is that sometimes we get to compare a language such as php with an entire environment like java with its remarkable JRE, C# with its .NET framework, even RoR lets be honest Ruby by it self w/o Rails not such a big deal. php like C++ is as secure and efficient as its developer.

 
DAFQ

@M_A_S

English, do you speak it?

 
D'Soto

Hard to explain it clearer, Excellent.

 

I agree, that both, the PHP programming language & the PHP programming enviroment works !!!

And, sometimes want to use another programming language, but, just, doesn't work...

 

Beside factors you regarded, I think that one of the most effective factors that made PHP so popular is documentation and resources. My first days with web applications development started with classical ASP, but with the first glance with PHP, I decided to path ASP away. In PHP, I found, a downloadable, complete official documentation for free. I found answers for the most of my beginner's questions easily through many free forums and articles.

 
Anonymous

Great analogies!

 
mensahero

IMHO, It's not the language, its more on the developer who use it. PHP is not good when used NATIVELY same as with Java or any other languages in its native form; meaning without FRAMEWORKS.

Language is not the problem. Developers who develop web applications using a language in its Native Form is the problem. PHP may not level with other languages in their native form but with its abundance of existing solutions such as Joomla, Wordpress, etc where you don't have to deal with Native PHP, that's where it truly outmatched other platforms.

PHP is superior in terms of deployment but its deployment is not really part of the application development, hence should not be used for comparison. Unless your web apps efficiently in terms of scalability and maintainability is measured on how easy it is to deploy.

A good developer will aim for a language that will let you write LESS code to achieve the same task even if it means learning a new language.

 
Anonymous

Totally agree. PHP is my first language, and even though I hardly use it on my job (mostly node.js and ruby there), I still work with php for most of my simple consultancy work because it simply works. If a client wants a website with a lot of customizable content, it is much easier for me to just use Wordpress and concentrate on the front end HTML/CSS coding and making a nice theme.

 
magyury

I agree, from a year ago i'm using yii framework and i can believe that still now surprises me with this double-clawed hammer :)

 

WebFaction.com makes the easy, ~idiot-proof Python hosting possible with $10 cost and almost one-click Django/RoR/etc. installers.

 
Anonymous

Nice article, I get where you are coming from.

 

I love PHP. I've worked with many other languages and I have to say PHP is my favorite by far. It has a lot of flexibility and scalability, and I love working with it. I wouldn't go as far to say any language is horrible; everyone has their own preferences. Those who say things like that should really just keep their mouth shut. :) Don't knock it until you try it!

 
Kenzo

"This is the market that PHP has cornered, I'm sure entirely by accident, by being the only language that makes deploying a website effectively idiot-proof. [...] PHP is so easily set-and-forget, that $10 hosting actually becomes plausible."

Rasmus once explained in a talk that this wasn't at all by accident. Their focus in the early days was on making the language very appealing to shared hosting companies, and creating features deliberately designed around that environment. This is one of the primary reasons why PHP caught on like wildfire.

 
migueljimenez

Where is the share button? This is great ;)

 

Very nice article! We will probably write a similar article for our community in German, refering to this.

Thank you very much,
Manuel

 

You weren't kidding. That was LONG ASS anti-PHP rant. Yours was great though.

I just think that popular things, ALWAYS get hate. It's just that way it is. Hence some dude it is the Justin Bieber of Programming.

 
Samuel Levy

This post has received an unexpectedly large (and happily positive) response... which says to me that this is someone a lot of people have been thinking, but hadn't put into words yet.

For the few who mentioned ASP.NET; finding cheap ASP hosting isn't always easy. There's also the problem that it's a proprietary language which only runs on one family of operating systems (I'm not about to get into a windows/mac/linux rant here, but the majority of web servers in the world are not windows-based).

ASP falls down at the hurdle of easily accessible, cheap, and reliable managed hosting that supports it. I'm not saying that those hosts don't exist, but the ones that do are the exception, and far less common than PHP hosts.

 

I'm almost irritated to read about inconsistency of PHP function library. In fact, I use mostly about 20 different built-in functions in PHP, so the inconsistency isn't really a big problem.

There are multiple reasons to use PHP in the web. I may be wrong, but I think it's the only language that's build for preprosessing HTML pages, and that's why it shines in doing that.

In fact, web applications are simple and most of the work is done on the HTML5 / jQuery / CSS -side anyway, so the backend language is not that important... as long as:
1) deploying and making simple changes is easy and fast (== costs less money)
2) websites stay alive no matter what (something is almost always better than nothing in the web)
3) it's possible and easy to build your web sites in a modular way

Just now I do most of my programming in C#.NET and Java/Android, but for small to mid size web applications there is just no sane alternatives for PHP. Ruby is nice and Python is not bad at all, but there are several practical reasons to use PHP for simple web sites instead of Ruby or Python.

 

I almost forgot...

Argument number one against PHP is that "PHP makes you to write bad code" which is obviously rubbish.

Tools doesn't really matter. Programmers do. Good programmer writes absolutely fantastic code in PHP or even in BASIC and bad programmer writes horrible crap in Ruby or Scala.

Only languages that doesn't allow you to write readable code such as Ook! Ook!, Brainfuck and Perl ( ;-) ) prevent you from writing good code. Ok, the "write-only Perl" was a joke. Even with a Perl it's possible to write clean and readable code.

Obviously, most of the "PHP sucks" -rants are misguided in the way that they rant against PHP-as-a-framework (which you really don't want to use that much) instead of PHP-as-a-language or PHP-as-a-part-of-LAMP.

 
MUHAMMAD

Yeah. i agree , besides PHP is more friendly to learn.

 
Colyn

1. Put files here.
2. Done.
3. Profit.

 
Mick

I'm using PHP for almost every website, program, batch on internet. It does the job! And with us there are a million others who share there findings, tools and libraries. It's all there. If allowed (!) just copy and paste.
I love PHP!

 

THANK-YOU for writing this down. I so have to agree with you!

There is an other aspect to this question: PHP is also the tool of choice for companies that crank out projects like crazy. When you have to set up market testing projects in a mere matter of weeks (Lean method anyone) nobody has time to set up complicated server and testing environment, we just dial in our puppet do do us a new run in the mill LAMP stack and we're good to go. I've been long time searching for a replacement language for PHP that makes setups and deployment that easy and doesn't come with the same kind of idiotic stupidities PHP sometimes does, but I have yet to find one.

 
David

Well said!

If what you're doing can be accomplished with an off-the-shelf PHP CMS, go for it. No need to shoot a mouse with an elephant gun, such as reinventing menu systems, user logins, and permissions systems.

On the other hand, if you're reaching for a "framework" then I agree with the poster who said "welcome to hell." I've written large apps in various PHP frameworks and Rails. I'd pick Rails unless the choice is made for me and the project domain is interesting.

 
Lilbitwacke

Spot on!
Some of my clients have even requested their python based software be replaced with something PHP based. Python was just too much headache.